Submission #974254

# Submission time Handle Problem Language Result Execution time Memory
974254 2024-05-03T06:53:32 Z vjudge1 Ljeto (COCI21_ljeto) C++17
50 / 50
0 ms 360 KB
// #include <bits/stdc++.h>
// using namespace std;

// int main(){
//     int n;
//     vector<pair<int,int> > bebek;
//     vector<pair<int,int> > elang;
//     cin>>n;
//     for(int i=1;i<=n;i++){
//         int t,a,b;
//         cin>>t>>a>>b;
//         if(a<b)elang.push_back(make_pair(t,a));
//         else bebek.push_back(make_pair(t,a));
//         // first=waktu, second=orang yang lempar
//     }
//     int poinBebek=0,poinElang=0;
//     for(int i=0;i<elang.size();i++){
//         if(i==0)poinElang+=100;
//         else{
//             if(elang[i].second==elang[i-1].second&&elang[i].first-elang[i-1].first<=10)poinElang+=150;
//             else poinElang+=100;
//         }
//     }
//     for(int i=0;i<bebek.size();i++){
//         if(i==0)poinBebek+=100;
//         else{
//             if(bebek[i].second==bebek[i-1].second&&bebek[i].first-bebek[i-1].first<=10)poinBebek+=150;
//             else poinBebek+=100;
//         }
//     }
//     cout<<poinElang<<' '<<poinBebek<<endl;
//     return 0;
// }

// below is revised code

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,bebek=0,elang=0;
    cin>>n;
    int lempar[9];
    for(int i=1;i<=8;i++)lempar[i]=-1e9;
    for(int i=1;i<=n;i++){
        int t,a,b,poin=100;
        cin>>t>>a>>b;
        if(t-lempar[a]<=10)poin=150;
        lempar[a]=t;
        if(a>b)bebek+=poin;
        else elang+=poin;
        // first=waktu, second=orang yang lempar
    }
    cout<<elang<<' '<<bebek<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct