Submission #595778

# Submission time Handle Problem Language Result Execution time Memory
595778 2022-07-14T06:29:31 Z 이동현(#8445) IOI Fever (JOI21_fever) C++17
6 / 100
1 ms 340 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

pair<int, int> cross(pair<int, int> x, int t, int dir, pair<int, int> y){
    //cout << x.first << ' ' << x.second << ' ' << t << ' ' << dir << ' ' << y.first << ' ' << y.second << endl;
    y.first -= x.first, y.second -= x.second;
    for(int i = 0; i < dir; ++i){
        y = {-y.second, y.first};
    }
    y.first += x.first, y.second += x.second;
    int nt = 0, ndir = 0;
    if(y.second - t >= x.second + t && x.first == y.first){
        nt = y.second - (x.second + y.second) / 2;
        ndir = 2;
    }
    else if(y.first - y.second == x.first - x.second && x.second + t <= y.second){
        nt = y.second - x.second;
        ndir = 3;
    }
    else if(y.first + y.second == x.first + x.second && x.second + t <= y.second){
        nt = y.second - x.second;
        ndir = 1;
    }
    ndir = (ndir + dir) % 4;
    return {nt, ndir};
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i].first >> a[i].second;
    }
    int ans = 0;
    for(int rep = 1; rep < 2; ++rep){
        vector<int> chk(n);
        queue<vector<int>> que;
        chk[0] = 1, que.push({0, 0, rep});
        while(!que.empty()){
            int id = que.front()[0], t = que.front()[1], dir = que.front()[2];
            que.pop();
            for(int i = 0; i < n; ++i){
                if(chk[i]){
                    continue;
                }
                pair<int, int> nt = cross(a[id], t, dir, a[i]);
                if(nt.first > 0){
                    chk[i] = 1;
                    que.push({i, nt.first, nt.second});
                }
            }
        }
        int cnt = 0;
        for(int i = 0; i < n; ++i){
            cnt += chk[i];
        }
        ans = max(ans, cnt);
    }
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Incorrect 0 ms 316 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Incorrect 0 ms 316 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Incorrect 0 ms 316 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Incorrect 0 ms 316 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Incorrect 0 ms 316 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Incorrect 0 ms 316 KB Output isn't correct
6 Halted 0 ms 0 KB -