답안 #866817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
866817 2023-10-27T07:53:34 Z 3as8 Ljeto (COCI21_ljeto) C++14
50 / 50
1 ms 456 KB
#include <bits/stdc++.h>

#define ll long long
#define endl "\n"
#define fastIO cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);

#define mid ((l + r) / 2)
#define lChild ((index * 2) + 1)
#define rChild ((index * 2) + 2)

using namespace std;

struct node {
    ll t, a, b;
};

bool isTeam1(ll a) {
    return a <= 4;
}

void solve(ll _) {

   ll n; cin>>n;

   vector<node> arr(n);

   for(int i = 0; i < n; i++) cin>>arr[i].t>>arr[i].a>>arr[i].b;

    ll sA = 0, sB = 0;

    ll teamStreak = -1;
    for(int i = 0; i < n; i++) {

        bool lastTime = false;
        bool teamA = isTeam1(arr[i].a);

        for(int j = i - 1; j >= 0; j--) {
            if(arr[i].t - arr[j].t > 10) break;

            if(arr[i].a == arr[j].a) {
              lastTime = true;
              break;
            }
        }

        if(teamA) sA += 100 + (lastTime * 50);
        else sB += 100 + (lastTime * 50);
    }


    cout<<sA<<" "<<sB<<endl;

}

int main() {
    fastIO

    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);

    ll t = 0;  solve(t);
}

Compilation message

Main.cpp: In function 'void solve(long long int)':
Main.cpp:31:8: warning: unused variable 'teamStreak' [-Wunused-variable]
   31 |     ll teamStreak = -1;
      |        ^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
# 결과 실행 시간 메모리 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 452 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 456 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct