답안 #963975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963975 2024-04-16T06:18:00 Z hugsfromadicto Ljeto (COCI21_ljeto) C++14
50 / 50
1 ms 500 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define OPT ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define vi vector<int>
#define all(a) a.begin(),a.end()
#define pb push_back
#define MAX(a,b,c) max(a,max(b,c))
#define MIN(a,b,c) min(a,min(b,c))
using namespace std;
void USACO(string filename){
  freopen((filename+".in").c_str(),"r",stdin);
  freopen((filename+".out").c_str(),"w",stdout);
}

struct BIT
{
    int n;
    vector<int> ft;
    void init(int N)
    {
        n = N + 5;
        ft.assign(n + 5, 0);
    }
    void add(int pos, int val)
    {
        for (pos = pos + 1; pos <= n; pos += pos & -pos) ft[pos] += val;
    }
    int get(int pos, int res = 0)
    {
        for (pos = pos + 1; pos > 0; pos -= pos & -pos) res += ft[pos];
        return res;
    }
};
struct DSU{
    vector<int>par;
    vector<int>sz;
    int n;
    DSU (int _n)
    {
        n = _n;
        par.resize(n + 1, 0);
        sz.resize(n + 1,1);
        for(int i = 1; i <= n; ++i)
            par[i] = i;
    }
    int _find(int v)
    {
        if(par[v] == v)
            return v;
        return par[v] = _find(par[v]);
    }
    void _union(int a, int b)
    {
        a = par[a];
        b = par[b];
        if(a != b)
        {
            if(sz[a] < sz[b])
                swap(a,b);
            par[b] = a;
            sz[a] += sz[b];
        }
    }
};
const int N = 105;
const int INF = 1e9;
void _()
{
    int n;
    cin >> n;
    vector<int>p(8, -INF);
    int ans[2] = {0,0};
    for(int i = 0; i <n; ++i)
    {
        int t,a,b;
        cin >> t >> a >> b;
        --a, --b;
        int pr = 100;
        if(p[a] >= t - 10)
            pr += 50;
        p[a] = t;
        ans[a >= 4] += pr;
    }
    cout << ans[0] << ' ' << ans[1] << endl;

}


main()
{
    OPT
    int tc = 1;
    while(tc--)
        _();
}

Compilation message

Main.cpp:94:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   94 | main()
      | ^~~~
Main.cpp: In function 'void USACO(std::string)':
Main.cpp:16:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   freopen((filename+".in").c_str(),"r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   freopen((filename+".out").c_str(),"w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 500 KB Output is correct
2 Correct 0 ms 460 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 500 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 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 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct