답안 #1077117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077117 2024-08-27T01:04:44 Z shiroboyy Ljeto (COCI21_ljeto) C++14
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define endl "\n"
#define fi first
#define se second
#define SZ(x) (x).size()
#define ALL(x) (x).begin(), (x).end()
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(x) (1LL << (x))
#define rep(i, l, r) for (int i = (l), _r = (r); i <= _r; i++)
#define rev(i, r, l) for (int i = (r), _l = (l); i >= _l; i--)

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

template<class X, class Y> inline bool maximize(X &x, const Y &y) {return x < y ? x = y, 1 : 0;}
template<class X, class Y> inline bool minimize(X &x, const Y &y) {return x > y ? x = y, 1 : 0;}

const int MAX = 2e5 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;

int last[9];

void solve() {
    int n; cin >> n;

    int score_a = 0, score_b = 0;
    rep(i, 1, n) {
        int t, a, b; cin >> t >> a >> b;

        if (a <= 4) score_a += 100;
        if (a >= 5) score_b += 100;

        if (t - last[a] <= 10 && i > 1) {
            if (a <= 4) score_a += 50;
            if (a >= 5) score_b += 50;
        }

        last[a] = t;

        cerr << score_a << " " << score_b << endl;
    }

    cout << score_a << " " << score_b << endl;
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #define task "ljeto"

    if (fopen(task".inp", "r")) {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }

    int test_case = 1; //cin >> test_case;
    while (test_case--) {
        solve();
    }

   cerr << "\nTime elapsed: " << clock() * 1.0 / CLOCKS_PER_SEC << " seconds" << endl;
}


Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:61:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:62:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |         freopen(task".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 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 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 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 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct