Submission #689389

#TimeUsernameProblemLanguageResultExecution timeMemory
689389ToroTNStreet Lamps (APIO19_street_lamps)C++14
20 / 100
2 ms468 KiB
#include<bits/stdc++.h> using namespace std; int n,m,l,r,cnt,ans; char s[105][105],op[15]; int main() { scanf("%d%d",&n,&m); scanf("%s",s[1]+1); for(int i=1;i<=m;i++) { scanf("%s",op); if(op[0]=='q') { scanf("%d%d",&l,&r); ans=0; for(int j=1;j<=i;j++) { cnt=0; for(int k=l;k<r;k++) { if(s[j][k]=='1')++cnt; } if(cnt==r-l)++ans; } printf("%d\n",ans); for(int j=1;j<=n;j++)s[i+1][j]=s[i][j]; }else { for(int j=1;j<=n;j++)s[i+1][j]=s[i][j]; scanf("%d",&l); s[i+1][l]='1'+'0'-s[i+1][l]; } } }

Compilation message (stderr)

street_lamps.cpp: In function 'int main()':
street_lamps.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
street_lamps.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%s",s[1]+1);
      |     ~~~~~^~~~~~~~~~~~~
street_lamps.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%s",op);
      |         ~~~~~^~~~~~~~~
street_lamps.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |             scanf("%d%d",&l,&r);
      |             ~~~~~^~~~~~~~~~~~~~
street_lamps.cpp:30:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |             scanf("%d",&l);
      |             ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...