답안 #910661

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
910661 2024-01-18T06:57:21 Z ibm2006 가로등 (APIO19_street_lamps) C++17
20 / 100
5000 ms 38036 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[1100000],b[1100][1100],q,ee;
char c[110000];
int main()
{
    scanf("%lld %lld",&n,&q);
    for(i=1;i<=n;i++)
    {
        scanf("%01lld",&a[i]);
    }
    for(ee=0;ee<q;ee++)
    {
        scanf("\n%s",c);
        if(c[0]=='t')
        {
            scanf("%lld",&x);

            for(i=1;i<=n;i++)
            {
                s=1;
                for(j=i;j<=n;j++)
                {
                    s&=a[j];
                    b[i][j]+=s;
                }
            }
            a[x]^=1;
            continue;
        }
        for(i=1;i<=n;i++)
            {
                s=1;
                for(j=i;j<=n;j++)
                {
                    s&=a[j];
                    b[i][j]+=s;
                }
            }
        scanf("%lld %lld",&x,&y);
        printf("%lld\n",b[x][y-1]);
    }
}

Compilation message

street_lamps.cpp: In function 'int main()':
street_lamps.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%lld %lld",&n,&q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
street_lamps.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%01lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~
street_lamps.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("\n%s",c);
      |         ~~~~~^~~~~~~~~~
street_lamps.cpp:18:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |             scanf("%lld",&x);
      |             ~~~~~^~~~~~~~~~~
street_lamps.cpp:41:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         scanf("%lld %lld",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 2 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 2 ms 4444 KB Output is correct
6 Correct 2 ms 4540 KB Output is correct
7 Correct 2 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1231 ms 8636 KB Output is correct
2 Execution timed out 5020 ms 9240 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 305 ms 10764 KB Output is correct
2 Correct 319 ms 10768 KB Output is correct
3 Correct 316 ms 10588 KB Output is correct
4 Correct 335 ms 10584 KB Output is correct
5 Runtime error 358 ms 37620 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 340 ms 11040 KB Output is correct
2 Correct 333 ms 10768 KB Output is correct
3 Correct 315 ms 10768 KB Output is correct
4 Correct 304 ms 10588 KB Output is correct
5 Runtime error 368 ms 38036 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 2 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 4444 KB Output is correct
5 Correct 2 ms 4444 KB Output is correct
6 Correct 2 ms 4540 KB Output is correct
7 Correct 2 ms 4444 KB Output is correct
8 Correct 1231 ms 8636 KB Output is correct
9 Execution timed out 5020 ms 9240 KB Time limit exceeded
10 Halted 0 ms 0 KB -