답안 #836025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
836025 2023-08-24T05:15:40 Z exodus_ Ljeto (COCI21_ljeto) C++14
25 / 50
1 ms 304 KB
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3+3;
int t[maxn];
int a[maxn], b[maxn];
int cat[10];
int main() {
    int n;
    cin >> n;
    int tima=0, timb=0;
    for(int i=1; i<=n; i++) {
        cin >> t[i] >> a[i] >> b[i];
        if(a[i]>=1 && a[i]<=4) {
            tima+=100;
        }
        if(a[i]>=5 && a[i]<=8) {
            timb+=100;
        }
    }
    for(int i=1; i<=10; i++) cat[i] = 1;
    int idx = 1;
    while(idx <= n) {
        int i = idx+1;
        int kali = 1;
        while(t[i]-t[idx]<=10 && a[i]==a[idx]) {
            if(a[idx]>=1 && a[idx]<=4) tima+=kali*50;
            if(a[idx]>=5 && a[idx]<=8) timb+=kali*50;
            kali++;
            i++;
        }
        idx++;
    }
    cout << tima << " " << timb << endl;
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:20:37: warning: iteration 9 invokes undefined behavior [-Waggressive-loop-optimizations]
   20 |     for(int i=1; i<=10; i++) cat[i] = 1;
      |                              ~~~~~~~^~~
Main.cpp:20:19: note: within this loop
   20 |     for(int i=1; i<=10; i++) cat[i] = 1;
      |                  ~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 1 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -