# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
241084 | 2020-06-22T14:17:27 Z | vanic | Segway (COI19_segway) | C++14 | 26 ms | 384 KB |
#include <iostream> #include <math.h> #include <cstdio> #include <algorithm> #include <vector> using namespace std; const int maxn=2e4+5, maxs=305; int v[maxn][3]; vector < int > pos[maxs]; int dio[maxn]; int ispred[maxn]; int ubrz[maxn]; bool acel[maxs]; int sol[maxn]; bool bio[maxn]; int main(){ int n; cin >> n; for(int i=0; i<n; i++){ cin >> v[i][0] >> v[i][1] >> v[i][2]; } int m; cin >> m; int a; for(int i=0; i<m; i++){ cin >> a; acel[a]=1; } for(int i=0; i<n; i++){ pos[0].push_back(i); } int cilj=n; int mini; int prog; int proslo=0; while(cilj){ mini=100; for(int i=0; i<300; i++){ for(int j=0; j<pos[i].size(); j++){ if(ubrz[pos[i][j]]){ mini=1; } else{ mini=min(mini, v[pos[i][j]][i/100]-dio[pos[i][j]]); } } } proslo+=mini; for(int i=0; i<300; i++){ for(int j=0; j<pos[i].size(); j++){ if(!bio[pos[i][j]]){ bio[pos[i][j]]=1; prog=0; if(ubrz[pos[i][j]]){ prog=1; ubrz[pos[i][j]]--; } else{ dio[pos[i][j]]+=mini; if(dio[pos[i][j]]==v[pos[i][j]][i/100]){ prog=2; dio[pos[i][j]]=0; } } if(prog){ ispred[pos[i][j]]-=pos[i+1].size(); pos[i+1].push_back(pos[i][j]); if(prog==2 && acel[i+1]){ ubrz[pos[i][j]]=ispred[pos[i][j]]%20; } if(i+1==300){ sol[pos[i][j]]=proslo; cilj--; } pos[i].erase(pos[i].begin()+j); j--; for(int k=0; k<pos[i].size(); k++){ ispred[pos[i][k]]++; } } } } } for(int i=0; i<n; i++){ bio[i]=0; } } for(int i=0; i<n; i++){ cout << sol[i] << '\n'; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 26 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 26 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |