Submission #565649

#TimeUsernameProblemLanguageResultExecution timeMemory
565649almothana05Election (BOI18_election)C++14
28 / 100
3062 ms920 KiB
#include<bits/stdc++.h> #define mod 1000000007 ////////////////////////////////////////////////////////// #define inf 100000000000000000 using namespace std; int num[300000]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int menge , numm , nummer , que; string s; cin >> menge >> s; cin >> que; int erg; while(que--){ erg = 0; cin >> numm >> nummer; numm--; nummer--; int t = 0 , c = 0; for(int i = numm ; i <= nummer ; i++){ if(s[i] == 'T'){ t++; } else{ c++; } if(t > c){ num[i] = 1; erg++; t--; } } t = 0; c = 0; for(int i = nummer; i >= numm ; i--){ if(num[i] == 1){ continue; } if(s[i] == 'T'){ t++; } else{ c++; } if(t > c){ num[i] = 1; erg++; t--; } } cout << erg << "\n"; for(int i = 0 ; i < s.size() ; i++){ num[i] = 0; } } }

Compilation message (stderr)

election.cpp: In function 'int main()':
election.cpp:53:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |       for(int i = 0 ; i < s.size() ; i++){
      |                       ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...