제출 #432704

#제출 시각아이디문제언어결과실행 시간메모리
432704inwbearStreet Lamps (APIO19_street_lamps)C++14
20 / 100
154 ms9652 KiB
#include <bits/stdc++.h> using namespace std; int n,m,ans[300005],ls[300005],a,b; char c[300005],qq[10]; int main() { scanf("%d %d",&n,&m); scanf("%s",c+1); for(int i=1;i<=n;i++)ls[i]=1; for(int i=1;i<=m;i++) { scanf("%s",qq+1); if(qq[1]=='t') { scanf("%d",&a); if(c[a]=='1') { ans[a]+=i-ls[a]+1; c[a]='0'; } else { c[a]='1'; ls[a]=i+1; } } else { scanf("%d %d",&a,&b); if(c[a]=='1')printf("%d\n",ans[a]+i-ls[a]+1); else printf("%d\n",ans[a]); } } }

컴파일 시 표준 에러 (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",c+1);
      |     ~~~~~^~~~~~~~~~
street_lamps.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%s",qq+1);
      |         ~~~~~^~~~~~~~~~~
street_lamps.cpp:15:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |             scanf("%d",&a);
      |             ~~~~~^~~~~~~~~
street_lamps.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf("%d %d",&a,&b);
      |             ~~~~~^~~~~~~~~~~~~~~
#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...