Submission #1041520

#TimeUsernameProblemLanguageResultExecution timeMemory
1041520vjudge1Segway (COI19_segway)C++17
100 / 100
610 ms1480 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define terminator main #define N 20001 #define D 300 int M[D]; int O[D]; int ans[N]; int s[N][3]; priority_queue<pair<pii,pii>,vector<pair<pii,pii>>,greater<pair<pii,pii>>> Q; void solve(){ int n,m,o,t,k,d,b; cin>>n; for(int i=1;i<=n;i++){ for(int j=0;j<3;j++) cin>>s[i][j]; Q.push({{s[i][0],i},{1,0}}); } vector<int> v; cin>>m; while(m--){ cin>>o; M[o]=1; } m=0; while(!Q.empty()){ t=Q.top().ff.ff; k=Q.top().ff.ss; d=Q.top().ss.ff; b=Q.top().ss.ss; Q.pop(); if(d==300){ ans[k]=t; continue; } if(t>m){ m=t; for(auto& i:v) O[i]=(O[i]+1)%20; v.clear(); } v.append(d); o=d/100; o=s[k][o]; if(!b && M[d]) b=O[d]; if(b){ o=1; b--; } Q.push({{t+o,k},{d+1,b}}); } cout<<ans[1]; for(int i=2;i<=n;i++) cout<<nl<<ans[i]; } int terminator(){ //L0TA; solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...