Submission #874959

#TimeUsernameProblemLanguageResultExecution timeMemory
874959creepedLjeto (COCI21_ljeto)C++14
50 / 50
1 ms436 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; void solve() { ll n; cin>>n; ll a[n+1], b[n+1], t[n+1]; ll x[10],y[10]; for(ll i=1;i<=10;i++) x[i] = y[i] = -10000; ll ans1=0, ans2=0; for(ll i=1;i<=n;i++) { cin>>t[i]>>a[i]>>b[i]; if(a[i] > 0 and a[i] < 5) { ans1 += 100; if(t[i] - x[a[i]]<= 10) ans1 += 50; x[a[i]] = t[i]; } else { ans2 += 100; if(t[i] - y[a[i]] <= 10) ans2 += 50; y[a[i]] = t[i]; } } cout<<ans1<<" "<<ans2<<endl; } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); ll ttt=1; //cin>>ttt; while(ttt--) { solve(); } }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:12:21: warning: iteration 9 invokes undefined behavior [-Waggressive-loop-optimizations]
   12 |         x[i] = y[i] = -10000;
      |                ~~~~~^~~~~~~~
Main.cpp:11:17: note: within this loop
   11 |     for(ll i=1;i<=10;i++)
      |                ~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...