답안 #863097

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863097 2023-10-19T15:21:10 Z ador Election (BOI18_election) C++17
0 / 100
11 ms 604 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, Q;
    string V;
    vector<vector<int>> vp;
    cin >> N >> V >> Q;
    
    for(int i=0;i<Q;i++) {
        int L, R;
        cin >> L >> R;
        vp.push_back({L, R});
    }
    
    for(int i=0; i<vp.size(); i++) {
        string subV = V.substr(vp[i][0]-1, vp[i][1]-vp[i][0]+1);
        int cv = 0, cvd = 0, tv = 0, tvd = 0, nulled = 0, nulledd = 0;
        for(int j=0;j<subV.size();j++) {
            if(subV[j] == 'T' && cv == tv) nulled++;
            else if (subV[j] == 'C') cv++;
            else tv++;
            
            if(subV[subV.size()-j-1] == 'T' && cvd == tvd) nulledd++;
            else if (subV[subV.size()-j-1] == 'C') cvd++;
            else tvd++;
        }
        cout << max(nulled, nulledd) << "\n";
    }
}

Compilation message

election.cpp: In function 'int main()':
election.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=0; i<vp.size(); i++) {
      |                  ~^~~~~~~~~~
election.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int j=0;j<subV.size();j++) {
      |                     ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -