답안 #908000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908000 2024-01-16T07:02:56 Z ibm2006 Tenis (COI19_tenis) C++17
0 / 100
500 ms 26860 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,i,j,k,l,r,x,y,z,w,s,t,a[4][1100000],b[4][4][1100000],perm[3][1100000],e,ee;
ll f(ll w)
{
    ll i,x,y,z,xx=0,yy=0,zz=0;
    for(i=1;i<=n;i++)
    {
        b[1][2][i]=max(b[1][2][i-1],a[2][perm[2][i]]);
        b[1][3][i]=max(b[1][3][i-1],a[3][perm[3][i]]);
        b[2][1][i]=max(b[2][1][i-1],a[1][perm[1][i]]);
        b[2][3][i]=max(b[2][3][i-1],a[3][perm[3][i]]);
        b[3][1][i]=max(b[3][1][i-1],a[1][perm[1][i]]);
        b[3][2][i]=max(b[3][2][i-1],a[2][perm[2][i]]);
    }
    x=a[1][w];
    y=a[2][w];
    z=a[3][w];
    while(x<n&&y<n&&z<n)
    {
        //printf("%lld %lld %lld:%lld %lld %lld\n",x,y,z,xx,yy,zz);
        xx=max(b[2][1][y],b[3][1][z]);
        yy=max(b[1][2][x],b[3][2][z]);
        zz=max(b[1][3][x],b[2][3][y]);
        if(x==xx&&y==yy&&z==zz)
            break;
        x=xx;
        y=yy;
        z=zz;
    }
    if(x<n&&y<n&&z<n)
        return 0;
    else
        return 1;
}
int main()
{
    scanf("%lld %lld",&n,&e);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[1][i]);
        a[1][i]=n+1-a[1][i];
        perm[1][a[1][i]]=i;
    }
    for(j=1;j<=n;j++)
    {
        scanf("%lld",&a[2][j]);
        a[2][j]=n+1-a[2][j];
        perm[2][a[2][j]]=j;
    }
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[3][i]);
        a[3][i]=n+1-a[3][i];
        perm[3][a[3][i]]=i;
    }
    for(ee=0;ee<e;ee++)
    {
        scanf("%lld",&x);
        if(x==1)
        {
            scanf("%lld",&y);
            if(f(y))
                printf("DA\n");
            else
                printf("NE\n");
            continue;
        }
        scanf("%lld %lld %lld",&z,&x,&y);
        swap(a[z][x],a[z][y]);
        perm[z][a[z][x]]=x;
        perm[z][a[z][y]]=y;
        /*for(i=1;i<=n;i++)
        {
          //  printf("(%lld,%lld,%lld)\n",a[1][i],a[2][i],a[3][i]);
        }
        for(i=1;i<=n;i++)
        {
           // printf("[%lld,%lld,%lld]\n",perm[1][i],perm[2][i],perm[3][i]);
        }*/
    }
}

Compilation message

tenis.cpp: In function 'int main()':
tenis.cpp:39:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |     scanf("%lld %lld",&n,&e);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
tenis.cpp:42:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         scanf("%lld",&a[1][i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
tenis.cpp:48:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         scanf("%lld",&a[2][j]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
tenis.cpp:54:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         scanf("%lld",&a[3][i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~
tenis.cpp:60:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |         scanf("%lld",&x);
      |         ~~~~~^~~~~~~~~~~
tenis.cpp:63:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |             scanf("%lld",&y);
      |             ~~~~~^~~~~~~~~~~
tenis.cpp:70:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |         scanf("%lld %lld %lld",&z,&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
tenis.cpp: In function 'll f(ll)':
tenis.cpp:11:48: warning: array subscript 3 is above array bounds of 'll [3][1100000]' {aka 'long long int [3][1100000]'} [-Warray-bounds]
   11 |         b[1][3][i]=max(b[1][3][i-1],a[3][perm[3][i]]);
      |                                          ~~~~~~^
tenis.cpp:4:59: note: while referencing 'perm'
    4 | ll n,i,j,k,l,r,x,y,z,w,s,t,a[4][1100000],b[4][4][1100000],perm[3][1100000],e,ee;
      |                                                           ^~~~
tenis.cpp: In function 'int main()':
tenis.cpp:56:15: warning: array subscript 3 is above array bounds of 'll [3][1100000]' {aka 'long long int [3][1100000]'} [-Warray-bounds]
   56 |         perm[3][a[3][i]]=i;
      |         ~~~~~~^
tenis.cpp:4:59: note: while referencing 'perm'
    4 | ll n,i,j,k,l,r,x,y,z,w,s,t,a[4][1100000],b[4][4][1100000],perm[3][1100000],e,ee;
      |                                                           ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1002 ms 26860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 12632 KB Output isn't correct
2 Halted 0 ms 0 KB -