Submission #636015

# Submission time Handle Problem Language Result Execution time Memory
636015 2022-08-27T16:28:03 Z Sofiatpc Ljeto (COCI21_ljeto) C++14
50 / 50
1 ms 296 KB
#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

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 time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 292 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 288 KB Output is correct