답안 #868977

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
868977 2023-11-02T17:36:02 Z SalihSahin Tenis (COI19_tenis) C++14
21 / 100
188 ms 13372 KB
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long 
using namespace std;

const int mod = 1e9 + 7;
const int N = 1e5 + 5;
const int inf = 1e18 + 5;

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

int32_t main(){
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    int n, q;
    cin>>n>>q;
    vector<vector<int> > arr(3, vector<int>(n));
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < n; j++){
            cin>>arr[i][j];
        }
    }
    vector<int> cnt(n+1), vis(n+1);
    map<int, int> ans;
    int tri = 0;
    for(int i = 0; i < n; i++){
        cnt[arr[0][i]]++;
        cnt[arr[1][i]]++;
        cnt[arr[2][i]]++;

        if(cnt[arr[0][i]] == 3){
            tri++;
            vis[arr[0][i]] = 1;
        }
        if(!vis[arr[1][i]] && cnt[arr[1][i]] == 3){
            tri++;
            vis[arr[1][i]] = 1;
        }
        if(!vis[arr[2][i]] && cnt[arr[2][i]] == 3){
            tri++;
            vis[arr[2][i]] = 1;
        }

        if(tri == i+1){
            for(int j = 1; j <= n; j++){
                if(vis[j]) ans[j] = 1;
            }
            break;
        }
    }

    while(q--){
        int qt, x;
        cin>>qt>>x;

        if(ans[x]) cout<<"DA"<<endl;
        else cout<<"NE"<<endl;
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 13120 KB Output is correct
2 Correct 169 ms 13120 KB Output is correct
3 Correct 177 ms 13124 KB Output is correct
4 Correct 172 ms 13092 KB Output is correct
5 Correct 172 ms 13176 KB Output is correct
6 Correct 188 ms 13116 KB Output is correct
7 Correct 168 ms 13140 KB Output is correct
8 Correct 178 ms 13120 KB Output is correct
9 Correct 177 ms 13372 KB Output is correct
10 Correct 168 ms 13128 KB Output is correct
11 Correct 175 ms 13124 KB Output is correct
12 Correct 169 ms 12928 KB Output is correct
13 Correct 173 ms 13128 KB Output is correct
14 Correct 172 ms 13120 KB Output is correct
15 Correct 171 ms 13088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -