Submission #38045447
Source Code Expand
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double PI = acos(-1);
int main() {
int n;
cin >> n;
string s;
cin >> s;
for (int i = 1; i <= n-1; i++) {
int cnt = 0;
for (int l = 0; l < n; l++) {
int r = l + i;
if (r >= n) break;
if (s[l] != s[r]) cnt++;
else break;
}
cout << cnt << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Longest Uncommon Prefix |
| User | taki0711 |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 790 Byte |
| Status | AC |
| Exec Time | 26 ms |
| Memory | 3612 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt |
| All | sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 6 ms | 3428 KiB |
| test_01.txt | AC | 2 ms | 3488 KiB |
| test_02.txt | AC | 2 ms | 3544 KiB |
| test_03.txt | AC | 2 ms | 3488 KiB |
| test_04.txt | AC | 2 ms | 3596 KiB |
| test_05.txt | AC | 2 ms | 3444 KiB |
| test_06.txt | AC | 2 ms | 3604 KiB |
| test_07.txt | AC | 2 ms | 3476 KiB |
| test_08.txt | AC | 23 ms | 3608 KiB |
| test_09.txt | AC | 14 ms | 3608 KiB |
| test_10.txt | AC | 23 ms | 3488 KiB |
| test_11.txt | AC | 26 ms | 3488 KiB |
| test_12.txt | AC | 5 ms | 3600 KiB |
| test_13.txt | AC | 3 ms | 3476 KiB |
| test_14.txt | AC | 2 ms | 3552 KiB |
| test_15.txt | AC | 10 ms | 3484 KiB |
| test_16.txt | AC | 11 ms | 3612 KiB |
| test_17.txt | AC | 16 ms | 3484 KiB |
| test_18.txt | AC | 21 ms | 3564 KiB |
| test_19.txt | AC | 14 ms | 3488 KiB |