Submission #636015

#TimeUsernameProblemLanguageResultExecution timeMemory
636015SofiatpcLjeto (COCI21_ljeto)C++14
50 / 50
1 ms296 KiB
#include <bits/stdc++.h> using namespace std; int l[8],p[2]; int team(int player) { if(player <= 4)return 1; return 2; } int main() { int N; cin>>N; for(int i = 1; i <= 8; i++)l[i]=-11; for(int i = 1; i <= N; i++) { int t,a,b; cin>>t>>a>>b; int x = team(a); p[x]+=100; if(t-l[a]<=10)p[x]+=50; l[a]=t; } cout<<p[1]<<" "<<p[2]<<"\n"; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:18:36: warning: iteration 7 invokes undefined behavior [-Waggressive-loop-optimizations]
   18 |     for(int i = 1; i <= 8; i++)l[i]=-11;
      |                                ~~~~^~~~
Main.cpp:18:22: note: within this loop
   18 |     for(int i = 1; i <= 8; i++)l[i]=-11;
      |                    ~~^~~~
Main.cpp:32:28: warning: array subscript 2 is above array bounds of 'int [2]' [-Warray-bounds]
   32 |     cout<<p[1]<<" "<<p[2]<<"\n";
      |                            ^~~~
Main.cpp:5:10: note: while referencing 'p'
    5 | int l[8],p[2];
      |          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...