AtCoder Regular Contest 028

Submission #2977982

Source codeソースコード

#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x[ohara],y,sum=0,pos,k;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

      
      
     cin>>n>>k;
    priority_queue<ll> que;
     
     rep(i,n)cin>>x[i];
     
     map<ll,ll> mp;
     
     rep(i,n){
             mp[x[i]]=i+1;
     }
     
     rep(i,k){
             que.push(x[i]);
     }
      cnt=k;
      rep(i,n-k+1){
              Cout(mp[que.top()]);
              if(que.top()>x[cnt]){
                      que.pop();
                      que.push(x[cnt]);
              }
              cnt++;
      }

       
return 0;
}

Submission

Task問題 B - 特別賞
User nameユーザ名 asdf1
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1850 Byte
File nameファイル名
Exec time実行時間 191 ms
Memory usageメモリ使用量 8444 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
Subtask1 40 / 40 sample_01.txt,sample_02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt
Subtask2 60 / 60 sample_01.txt,sample_02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask1_01.txt AC 1 ms 256 KB
subtask1_02.txt AC 1 ms 256 KB
subtask1_03.txt AC 1 ms 256 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 3 ms 384 KB
subtask1_06.txt AC 3 ms 384 KB
subtask1_07.txt AC 1 ms 384 KB
subtask1_08.txt AC 2 ms 384 KB
subtask1_09.txt AC 2 ms 384 KB
subtask1_10.txt AC 2 ms 384 KB
subtask1_11.txt AC 2 ms 384 KB
subtask2_01.txt AC 23 ms 1408 KB
subtask2_02.txt AC 2 ms 384 KB
subtask2_03.txt AC 142 ms 8060 KB
subtask2_04.txt AC 191 ms 7808 KB
subtask2_05.txt AC 43 ms 8444 KB
subtask2_06.txt AC 123 ms 8060 KB
subtask2_07.txt AC 148 ms 8060 KB
subtask2_08.txt AC 122 ms 8060 KB
subtask2_09.txt AC 133 ms 8060 KB