Submission #1118488

# Submission time Handle Problem Language Result Execution time Memory
1118488 2024-11-25T14:50:53 Z manhlinh1501 Ljeto (COCI21_ljeto) C++17
50 / 50
4 ms 2832 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

const int MAXN = 1e5 + 5;

int N;
vector<pair<int, int>> adj[MAXN];
pair<int, int> ans;

signed main() {
#define task ""
    if(fopen(task".inp", "r")) {
        freopen(task".inp", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> N;
    for(int i = 1; i <= N; i++) {
        int t = 0, u = 0, v = 0;
        cin >> t >> u >> v;
        adj[u].emplace_back(t, v);
    }
    for(int x = 1; x <= 4; x++) {
        for(int i = 0; i < (int)adj[x].size(); i++) {
            for(int j = i + 1; j < (int)adj[x].size(); j++) {
                if(abs(adj[x][j].first - adj[x][i].first) <= 10 and adj[x][j].second > 4) {
                    ans.first += 50;
                    break;
                }
            }
            if(adj[x][i].second > 4) ans.first += 100;
        }
    }

    for(int x = 5; x <= 8; x++) {
        for(int i = 0; i < (int)adj[x].size(); i++) {
            for(int j = i + 1; j < (int)adj[x].size(); j++) {
                if(abs(adj[x][j].first - adj[x][i].first) <= 10 and adj[x][j].second < 5) {
                    ans.second += 50;
                    break;
                }
            }
            if(adj[x][i].second < 5) ans.second += 100;
        }
    }
    cout << ans.first << " " << ans.second << "\n";
    return (0 ^ 0);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen(task".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2832 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 1 ms 2828 KB Output is correct
4 Correct 2 ms 2656 KB Output is correct
5 Correct 2 ms 2656 KB Output is correct
6 Correct 2 ms 2656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 2 ms 2832 KB Output is correct
4 Correct 2 ms 2656 KB Output is correct
5 Correct 1 ms 2828 KB Output is correct
6 Correct 2 ms 2656 KB Output is correct
7 Correct 2 ms 2656 KB Output is correct
8 Correct 2 ms 2656 KB Output is correct
9 Correct 2 ms 2724 KB Output is correct
10 Correct 2 ms 2656 KB Output is correct
11 Correct 3 ms 2656 KB Output is correct
12 Correct 4 ms 2656 KB Output is correct
13 Correct 4 ms 2656 KB Output is correct