답안 #1041701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041701 2024-08-02T07:12:53 Z vjudge1 Tenis (COI19_tenis) C++17
21 / 100
32 ms 7472 KB
                                    ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 100001
int h[N];
int x[N];
int P[N][4];
int F[N][4];
bool vis[N];
bool query(int x){
    return 0;
}
void solve(int n,int m){
    vector<int> v;
    for(int i=1;i<=n;i++){
        if(!P[i][1]) v.append(i);
    }
    for(int i=h[v[0]]=0;i<n-1;i++){
        v.append(F[v[i]][1]);
        h[v[i+1]]=i+1;
    }
    h[0]=n;
    for(int i=n-1;i>=0;i--){
        x[i]=i;
        if(i<n-1) 
            x[i]=min(x[i],x[i+1]);
        x[i]=min(x[i],h[F[v[i]][2]]);
        x[i]=min(x[i],h[F[v[i]][3]]);
    }
    for(int i=0;i<n;i++)
        x[i]=x[x[i]];
    int p,q;
    while(m--){
        cin>>p>>q;
        if(x[h[q]])
            cout<<"NE\n";
        else cout<<"DA\n";
    }
}
void solve(){
    int n,m,o,p,q,r;
    cin>>n>>m;
    for(int j=1;j<4;j++){
        cin>>p;
        for(int i=1;i<n;i++){
            cin>>q;
            P[q][j]=p;
            F[p][j]=q;
            p=q;
        }
    }
    if(m>10){
        solve(n,m);
        return;
    }
    while(m--){
        cin>>o;
        if(o>1){
            cin>>p>>q>>r;
        }
        else{
            cin>>r;
            if(query(r))
                cout<<"DA\n";
            else cout<<"NE\n";
        }
    }
}
int terminator(){
    L0TA;
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 5596 KB Output is correct
2 Correct 30 ms 7380 KB Output is correct
3 Correct 32 ms 7380 KB Output is correct
4 Correct 30 ms 7380 KB Output is correct
5 Correct 25 ms 7328 KB Output is correct
6 Correct 27 ms 7384 KB Output is correct
7 Correct 27 ms 7380 KB Output is correct
8 Correct 26 ms 7468 KB Output is correct
9 Correct 26 ms 7376 KB Output is correct
10 Correct 30 ms 7348 KB Output is correct
11 Correct 28 ms 7388 KB Output is correct
12 Correct 27 ms 7376 KB Output is correct
13 Correct 26 ms 7472 KB Output is correct
14 Correct 26 ms 7380 KB Output is correct
15 Correct 27 ms 7376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -