Submission #46430957
Source Code Expand
/*
Author : Hocky Yudhiono
Sel 10 Okt 2023 05:15:29
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long LL;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> PII;
typedef pair<int, int> pii;
typedef pair<ll, ll> PLL;
typedef pair<ll, ll> pll;
typedef long double ld;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define popf pop_front
#define pf push_front
#define popb pop_back
#define pb push_back
#define fi first
#define se second
const double EPS = 1e-9;
const int INFMEM = 63;
// Do dir^1 to get reverse direction
const int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
const int dy[8] = {1, -1, 0, 0, 1, -1, -1, 1};
const char dch[4] = {'R', 'L', 'D', 'U'};
// Do (dir + 2)%4 to get reverse direction
// const int dx[8] = {-1,0,1,0,-1,1,1,-1};
// const int dy[8] = {0,1,0,-1,1,1,-1,-1};
// const char dch[4] = {'U','R','D','L'};
const double PI = 3.141592653589793;
inline void fasterios() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
}
#define endl '\n'
const int MOD = 1000000007;
// const int MOD = 998244353;
int main() {
fasterios();
int n; cin >> n;
string s; cin >> s;
for (int i = 0; i < sz(s); i++) {
if (i + 2 < sz(s)) {
if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
cout << i + 1 << endl;
return 0;
}
}
}
cout << -1 <<endl;
}
Submission Info
Submission Time |
|
Task |
A - First ABC 2 |
User |
hocky |
Language |
C++ 20 (gcc 12.2) |
Score |
100 |
Code Size |
1595 Byte |
Status |
AC |
Exec Time |
2 ms |
Memory |
3560 KiB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
100 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 02_min_00.txt, 03_max_00.txt, 03_max_01.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
1 ms |
3460 KiB |
00_sample_01.txt |
AC |
1 ms |
3396 KiB |
00_sample_02.txt |
AC |
1 ms |
3484 KiB |
01_random_00.txt |
AC |
1 ms |
3468 KiB |
01_random_01.txt |
AC |
1 ms |
3560 KiB |
01_random_02.txt |
AC |
1 ms |
3488 KiB |
01_random_03.txt |
AC |
2 ms |
3552 KiB |
01_random_04.txt |
AC |
1 ms |
3352 KiB |
02_min_00.txt |
AC |
1 ms |
3488 KiB |
03_max_00.txt |
AC |
1 ms |
3408 KiB |
03_max_01.txt |
AC |
1 ms |
3356 KiB |