Submission #836025

#TimeUsernameProblemLanguageResultExecution timeMemory
836025exodus_Ljeto (COCI21_ljeto)C++14
25 / 50
1 ms304 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 1e3+3; int t[maxn]; int a[maxn], b[maxn]; int cat[10]; int main() { int n; cin >> n; int tima=0, timb=0; for(int i=1; i<=n; i++) { cin >> t[i] >> a[i] >> b[i]; if(a[i]>=1 && a[i]<=4) { tima+=100; } if(a[i]>=5 && a[i]<=8) { timb+=100; } } for(int i=1; i<=10; i++) cat[i] = 1; int idx = 1; while(idx <= n) { int i = idx+1; int kali = 1; while(t[i]-t[idx]<=10 && a[i]==a[idx]) { if(a[idx]>=1 && a[idx]<=4) tima+=kali*50; if(a[idx]>=5 && a[idx]<=8) timb+=kali*50; kali++; i++; } idx++; } cout << tima << " " << timb << endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:20:37: warning: iteration 9 invokes undefined behavior [-Waggressive-loop-optimizations]
   20 |     for(int i=1; i<=10; i++) cat[i] = 1;
      |                              ~~~~~~~^~~
Main.cpp:20:19: note: within this loop
   20 |     for(int i=1; i<=10; i++) cat[i] = 1;
      |                  ~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...