Submission #910675

#TimeUsernameProblemLanguageResultExecution timeMemory
910675ibm2006Street Lamps (APIO19_street_lamps)C++17
20 / 100
117 ms18512 KiB
#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[1100000],q,ee,d[1100000]; char c[110000]; int main() { scanf("%lld %lld",&n,&q); for(i=1;i<=n;i++) { scanf("%01lld",&a[i]); } for(i=1;i<=n;i++) { if(a[i]==1) { d[i]=0; } else d[i]=-1; } for(ee=1;ee<=q;ee++) { scanf("\n%s",c); if(c[0]=='t') { scanf("%lld",&x); if(a[x]==1) b[x]+=ee-d[x]; else { d[x]=ee; } a[x]^=1; continue; } scanf("%lld %lld",&x,&y); if(a[x]==1) printf("%lld\n",b[x]+ee-d[x]); else printf("%lld\n",b[x]); } }

Compilation message (stderr)

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:25:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf("\n%s",c);
      |         ~~~~~^~~~~~~~~~
street_lamps.cpp:28:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |             scanf("%lld",&x);
      |             ~~~~~^~~~~~~~~~~
street_lamps.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |         scanf("%lld %lld",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
#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...