제출 #60539

#제출 시각아이디문제언어결과실행 시간메모리
60539SpaimaCarpatilorElection (BOI18_election)C++17
28 / 100
14 ms796 KiB
#include<bits/stdc++.h> using namespace std; int N, M; bool ap[2018]; char sir[2018]; int main () { //freopen ("input", "r", stdin); //freopen ("output", "w", stdout); scanf ("%d\n", &N); scanf ("%s", sir + 1); scanf ("%d", &M); while (M --) { int L, R; scanf ("%d %d", &L, &R); int curr = 0, cnt = 0; for (int i=L; i<=R; i++) if (sir[i] == 'C') curr ++; else if (curr == 0) ap[i] = 0, cnt ++; else curr --, ap[i] = 1; curr = 0; for (int i=R; i>=L; i--) if (sir[i] == 'C') curr ++; else if (ap[i]) { if (curr == 0) cnt ++; else curr --; } printf ("%d\n", cnt); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

election.cpp: In function 'int main()':
election.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%d\n", &N);
 ~~~~~~^~~~~~~~~~~~
election.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%s", sir + 1);
 ~~~~~~^~~~~~~~~~~~~~~
election.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%d", &M);
 ~~~~~~^~~~~~~~~~
election.cpp:20:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d %d", &L, &R);
     ~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...