# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844473 | vjudge1 | Nivelle (COCI20_nivelle) | C++17 | 1 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
#define endl '\n'
#define fi first
#define se second
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define CDIV(a,b) (((a)+(b)-(1))/(b))
const ll inf = 1e17 + 5;
const ll mod = 1e9 + 7;
const ll N = 1e3 + 30;
int mod_(int a, int b)
{
if(a >= 0)return a % b;
a += (-a/b + 1) * b;
return a % b;
}
ld eps = 1e-9;
struct p{
vector<int>pref;
p()
{
pref.assign(26,0);
}
p operator-(const p& b)
{
p res;
for(int i = 0; i < 26; ++i)
{
res.pref[i] = pref[i] - b.pref[i];
}
return res;
}
};
void solve()
{
int n;
string s;
cin >> n >> s;
s.pb('z');
bool a = any_of(s.begin(), s.end(), [&](char c){return c == 'a';});
bool b = any_of(s.begin(), s.end(), [&](char c){return c == 'b';});
int cnt = 1, mx = 1, l = 0, maxl = 0, maxr = 0;
for(int i = 1; i <= n; ++i)
{
if(s[i] != s[i - 1])
{
if(cnt > mx)
{
mx = cnt;
maxl = l;
maxr = i - 1;
}
l = i;
cnt = 1;
}
else cnt++;
}
if(2 * (maxr - maxl + 1) <= n)maxl = 0, maxr = n - 1;
cout << maxl + 1 << ' ' << maxr + 1 << endl;
}
int main()
{
fio;
//int t; cin >> t; while(t--)
{
solve();
}
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |