# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
571062 | 2022-06-01T07:43:19 Z | kshitij_sodani | MP3 Player (CEOI10_mp3player) | C++14 | 1000 ms | 1752 KB |
#include <bits/stdc++.h> using namespace std; typedef long long llo; #define a first #define b second #define pb push_back #define endl '\n' int n,m,aa; int it[100001]; int tt[100001]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>m>>aa; for(int i=0;i<n;i++){ char s; cin>>s; if(s=='+'){ it[i]=1; } else{ it[i]=-1; } cin>>tt[i+1]; } vector<int> ss; for(int i=0;i<n;i++){ ss.pb(tt[i+1]); ss[ss.size()-1]-=tt[i]; ss[ss.size()-1]-=1; } sort(ss.begin(),ss.end()); ss.pb(ss.back()+1); reverse(ss.begin(),ss.end()); /*for(auto j:ss){ cout<<j<<","; } cout<<endl;*/ for(int i=0;i<ss.size();i++){ pair<int,int> cur={aa,aa}; int st=1; for(int j=n-1;j>=1;j--){ if(tt[j+1]-tt[j]>ss[i]){ continue; } if(it[j]==-1){ cur.b+=1; cur.b=min(cur.b,m); cur.a+=1; if(cur.a==1){ cur.a=0; } } else{ cur.a=max(0,cur.a-1); cur.b-=1; if(cur.b==m-1){ cur.b=m; } } if(cur.a>cur.b){ st=0; break; } } if(st==1){ if(i==0){ cout<<"infinity"<<endl; } else{ cout<<ss[i]<<" "<<cur.b<<endl; } return 0; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 7 ms | 412 KB | Output is correct |
3 | Correct | 14 ms | 424 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 468 KB | Output is correct |
3 | Correct | 2 ms | 340 KB | Output is correct |
4 | Correct | 4 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 340 KB | Output is correct |
2 | Correct | 28 ms | 436 KB | Output is correct |
3 | Correct | 16 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 596 KB | Output is correct |
2 | Correct | 824 ms | 724 KB | Output is correct |
3 | Correct | 525 ms | 972 KB | Output is correct |
4 | Correct | 592 ms | 920 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 724 KB | Output is correct |
2 | Execution timed out | 1085 ms | 652 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 724 KB | Output is correct |
2 | Correct | 7 ms | 724 KB | Output is correct |
3 | Execution timed out | 1088 ms | 980 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 984 KB | Output is correct |
2 | Execution timed out | 1075 ms | 1012 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1084 ms | 1752 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1097 ms | 1648 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |