답안 #117763

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
117763 2019-06-17T07:37:01 Z 이온조(#2879) Tenis (COI19_tenis) C++14
21 / 100
102 ms 7908 KB
#include <bits/stdc++.h>
using namespace std;
using tiii = tuple<int, int, int>;

const int MXN = 100009;

struct player {
    int id, x, y, z;
} A[MXN];

int X[MXN], Y[MXN], Z[MXN];
int yl[MXN], yr[MXN], zl[MXN], zr[MXN];
int Ri[MXN];

int main() {
    int N, Q; scanf("%d%d",&N,&Q);
    for(int i=1; i<=N; i++) {scanf("%d",&X[i]); A[X[i]].x = i;}
    for(int i=1; i<=N; i++) {scanf("%d",&Y[i]); A[Y[i]].y = i;}
    for(int i=1; i<=N; i++) {scanf("%d",&Z[i]); A[Z[i]].z = i;}
    for(int i=1; i<=N; i++) A[i].id = i;
    sort(A+1, A+N+1, [&](player P, player Q) {return P.x < Q.x;});
    yr[N+1] = 1e9, zr[N+1] = 1e9;
    for(int i=1; i<=N; i++) yl[i] = max(yl[i-1], A[i].y), zl[i] = max(zl[i-1], A[i].z);
    for(int i=N; i>=1; i--) yr[i] = min(yr[i+1], A[i].y), zr[i] = min(zr[i+1], A[i].z);
    int l = N;
    for(int i=1; i<N; i++) if(yl[i] < yr[i+1] && zl[i] < zr[i+1]) {l = i; break;}
    for(int i=1; i<=N; i++) Ri[A[i].id] = A[i].x;
    while(Q--) {
        int X; scanf("%*d%d",&X);
        if(Ri[X] <= l) puts("DA");
        else puts("NE");
    }
    return 0;
}

Compilation message

tenis.cpp: In function 'int main()':
tenis.cpp:16:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N, Q; scanf("%d%d",&N,&Q);
               ~~~~~^~~~~~~~~~~~~~
tenis.cpp:17:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=N; i++) {scanf("%d",&X[i]); A[X[i]].x = i;}
                              ~~~~~^~~~~~~~~~~~
tenis.cpp:18:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=N; i++) {scanf("%d",&Y[i]); A[Y[i]].y = i;}
                              ~~~~~^~~~~~~~~~~~
tenis.cpp:19:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=N; i++) {scanf("%d",&Z[i]); A[Z[i]].z = i;}
                              ~~~~~^~~~~~~~~~~~
tenis.cpp:29:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int X; scanf("%*d%d",&X);
                ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 84 ms 7804 KB Output is correct
2 Correct 99 ms 7872 KB Output is correct
3 Correct 85 ms 7800 KB Output is correct
4 Correct 80 ms 7800 KB Output is correct
5 Correct 88 ms 7800 KB Output is correct
6 Correct 86 ms 7908 KB Output is correct
7 Correct 83 ms 7804 KB Output is correct
8 Correct 82 ms 7800 KB Output is correct
9 Correct 87 ms 7800 KB Output is correct
10 Correct 87 ms 7800 KB Output is correct
11 Correct 98 ms 7792 KB Output is correct
12 Correct 88 ms 7860 KB Output is correct
13 Correct 90 ms 7804 KB Output is correct
14 Correct 102 ms 7772 KB Output is correct
15 Correct 93 ms 7800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -