답안 #874959

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
874959 2023-11-18T09:55:06 Z creeped Ljeto (COCI21_ljeto) C++14
50 / 50
1 ms 436 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve()
{
    ll n;
    cin>>n;
    ll a[n+1], b[n+1], t[n+1];
    ll x[10],y[10];
    for(ll i=1;i<=10;i++)
        x[i] = y[i] = -10000;
    ll ans1=0, ans2=0;
    for(ll i=1;i<=n;i++)
    {
        cin>>t[i]>>a[i]>>b[i];
        if(a[i] > 0 and a[i] < 5)
        {
            ans1 += 100;
            if(t[i] - x[a[i]]<= 10)
                ans1 += 50;
            x[a[i]] = t[i];
        }
        else
        {
            ans2 += 100;
            if(t[i] - y[a[i]] <= 10)
                ans2 += 50;
            y[a[i]] = t[i];
        }
    }
    cout<<ans1<<" "<<ans2<<endl;
}


int main() {

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll ttt=1;
    //cin>>ttt;
    while(ttt--)
    {
        solve();
    }

}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:12:21: warning: iteration 9 invokes undefined behavior [-Waggressive-loop-optimizations]
   12 |         x[i] = y[i] = -10000;
      |                ~~~~~^~~~~~~~
Main.cpp:11:17: note: within this loop
   11 |     for(ll i=1;i<=10;i++)
      |                ~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 436 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