답안 #974203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
974203 2024-05-03T06:16:13 Z sleepntsheep Bitwise (BOI06_bitwise) C
0 / 100
1000 ms 600 KB
#include<stdio.h>

#define N 10000
int n,p,k[N],at[N+1];unsigned z,l[N],r[N];

int main()
{
    scanf("%d%d",&n,&p);
    for(int i=0;i<p;++i)
        scanf("%d",k+i);
    for(int i=0,len=0;i<p;++i)
    {
        at[i]=len;
        at[i+1]=len+=k[i];
        for(int j=at[i];j<at[i+1];++j)
            scanf("%d%d",l+j,r+j);
    }

    for(unsigned b=31;b>=0;--b)
    {
        unsigned set=1u<<b;
        for(int i=0;i<p;++i)
        {
            int can=0,tuna=0;
            for(int j=at[i];j<at[i+1];++j)
                if(l[j]<=set&&set<=r[j])++can,tuna=j;
            if(can==0)
                set=0;
        }
        if(set)
            for(int i=0;i<p;++i)
            {
                int can=0,tuna=0;
                for(int j=at[i];j<at[i+1];++j)
                    if(l[j]<=set&&set<=r[j])++can,tuna=j;
                l[tuna]-=set,r[tuna]-=set;
            }
        z|=set;
    }
    printf("%d",z);
}

Compilation message

bitwise.c: In function 'main':
bitwise.c:24:23: warning: variable 'tuna' set but not used [-Wunused-but-set-variable]
   24 |             int can=0,tuna=0;
      |                       ^~~~
bitwise.c:8:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%d",&n,&p);
      |     ^~~~~~~~~~~~~~~~~~~
bitwise.c:10:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%d",k+i);
      |         ^~~~~~~~~~~~~~~
bitwise.c:16:13: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             scanf("%d%d",l+j,r+j);
      |             ^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 348 KB Time limit exceeded
2 Execution timed out 1044 ms 344 KB Time limit exceeded
3 Execution timed out 1028 ms 600 KB Time limit exceeded
4 Execution timed out 1046 ms 348 KB Time limit exceeded
5 Execution timed out 1091 ms 344 KB Time limit exceeded
6 Execution timed out 1041 ms 344 KB Time limit exceeded
7 Execution timed out 1053 ms 348 KB Time limit exceeded
8 Execution timed out 1073 ms 348 KB Time limit exceeded
9 Execution timed out 1032 ms 344 KB Time limit exceeded
10 Execution timed out 1064 ms 348 KB Time limit exceeded
11 Execution timed out 1035 ms 344 KB Time limit exceeded
12 Execution timed out 1075 ms 348 KB Time limit exceeded
13 Execution timed out 1039 ms 344 KB Time limit exceeded
14 Execution timed out 1081 ms 348 KB Time limit exceeded
15 Execution timed out 1086 ms 348 KB Time limit exceeded
16 Execution timed out 1070 ms 348 KB Time limit exceeded
17 Execution timed out 1053 ms 348 KB Time limit exceeded
18 Execution timed out 1051 ms 348 KB Time limit exceeded
19 Execution timed out 1057 ms 348 KB Time limit exceeded
20 Execution timed out 1072 ms 348 KB Time limit exceeded