提出 #38046881
ソースコード 拡げる
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,j,k) for(register int i=j;i<=k;++i)
#define g(i,j,k) for(register int i=j;i>=k;--i)
int n,m,s,l;
char a[20202];
signed main(){
cin>>n;
scanf("%s",a+1);
f(i,1,n-1){
l=0;
while(a[l+1]!=a[l+i+1]&&l+i+1<=n)++l;
cout<<l<<endl;
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Longest Uncommon Prefix |
| ユーザ | scyxdl |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 200 |
| コード長 | 342 Byte |
| 結果 | AC |
| 実行時間 | 22 ms |
| メモリ | 3712 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:11:4: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
11 | f(i,1,n-1){
| ^
./Main.cpp:4:35: note: in definition of macro ‘f’
4 | #define f(i,j,k) for(register int i=j;i<=k;++i)
| ^
./Main.cpp:10:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
10 | scanf("%s",a+1);
| ~~~~~^~~~~~~~~~
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01.txt | AC | 8 ms | 3568 KiB |
| test_01.txt | AC | 2 ms | 3564 KiB |
| test_02.txt | AC | 2 ms | 3564 KiB |
| test_03.txt | AC | 2 ms | 3572 KiB |
| test_04.txt | AC | 2 ms | 3468 KiB |
| test_05.txt | AC | 2 ms | 3564 KiB |
| test_06.txt | AC | 2 ms | 3564 KiB |
| test_07.txt | AC | 2 ms | 3584 KiB |
| test_08.txt | AC | 21 ms | 3564 KiB |
| test_09.txt | AC | 19 ms | 3588 KiB |
| test_10.txt | AC | 22 ms | 3712 KiB |
| test_11.txt | AC | 21 ms | 3612 KiB |
| test_12.txt | AC | 2 ms | 3480 KiB |
| test_13.txt | AC | 2 ms | 3560 KiB |
| test_14.txt | AC | 3 ms | 3564 KiB |
| test_15.txt | AC | 8 ms | 3568 KiB |
| test_16.txt | AC | 9 ms | 3568 KiB |
| test_17.txt | AC | 12 ms | 3572 KiB |
| test_18.txt | AC | 20 ms | 3568 KiB |
| test_19.txt | AC | 16 ms | 3576 KiB |