Submission #480826

#TimeUsernameProblemLanguageResultExecution timeMemory
480826KarabasanElection (BOI18_election)C++17
0 / 100
21 ms332 KiB
#include <bits/stdc++.h> #define ll long long #define fast1 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4") #pragma GCC optimize("unroll-loops") int n,t,m; int pre[500005]; void solve() { string AAA; string s="G"; cin>>n; cin>>AAA; s+=AAA; int q; scanf("%d",&q); while(q--) { int a,b; cin>>a>>b; int c=0; int t=0; int mx=0; for(int i=a;i<=n;i++) { if(s[i]=='T') c++; else c--; mx=max(mx,c); } for(int i=b;i>=a;i--) { if(s[i]=='T') t++; else t--; mx=max(mx,t); } cout<<mx<<endl; } } int main() { // scanf("%d",&t); t=1; while(t--) { solve(); } return 0; }

Compilation message (stderr)

election.cpp: In function 'void solve()':
election.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |     scanf("%d",&q);
      |     ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...