| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 565618 | Abdulmohsen1284 | Election (BOI18_election) | C++14 | 3039 ms | 800 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include"bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long a[2000005],up[2000005];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n;
cin>>n;
string s;
cin>>s;
long long q;
cin>>q;
for(int i=0;i<q;i++)
{
long long fr,sc;
cin>>fr>>sc;
long long c=0,t=0,del=0;
vector <char> cur;
for(int i=fr-1;i<sc;i++)
{
cur.push_back(s[i]);
if(s[i]=='C')
c++;
else
t++;
if(t>c)
{
t--;
del++;
cur.pop_back();
}
}
reverse(cur.begin(),cur.end());
c=0;
t=0;
for(int i=0;i<cur.size();i++)
{
//cout<<cur[i];
if(cur[i]=='C')
c++;
else
t++;
if(t>c)
{
t--;
del++;
}
}
cout<<del<<"\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
