Submission #1358935
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef pair<int, int> pi; const int mod = 1e9 + 7; int rev[1000005], sfx[1000005]; char str[1000005]; int n; int main(){ scanf("%d",&n); for(int i=0; i<n; i++){ scanf("%d",&sfx[i]); sfx[i]--; rev[sfx[i]] = i; } memset(str, 0, sizeof(str)); rev[n] = -1; str[sfx[0]] = 'A'; for(int i=1; i<n; i++){ int p1 = sfx[i-1] + 1; int p2 = sfx[i] + 1; if(rev[p1] < rev[p2]){ str[sfx[i]] = str[sfx[i-1]]; } else{ str[sfx[i]] = str[sfx[i-1]] + 1; } } cout << str << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - suffix array |
User | koosaga |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 600 Byte |
Status | WA |
Exec Time | 124 ms |
Memory | 9984 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&sfx[i]); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | sample_01.txt, sample_02.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, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 2 ms | 3328 KB |
sample_02.txt | AC | 2 ms | 3328 KB |
test_01.txt | AC | 2 ms | 3328 KB |
test_02.txt | AC | 2 ms | 3328 KB |
test_03.txt | AC | 2 ms | 3328 KB |
test_04.txt | AC | 2 ms | 3328 KB |
test_05.txt | AC | 2 ms | 3328 KB |
test_06.txt | AC | 2 ms | 3328 KB |
test_07.txt | AC | 2 ms | 3328 KB |
test_08.txt | WA | 2 ms | 3328 KB |
test_09.txt | WA | 2 ms | 3328 KB |
test_10.txt | WA | 2 ms | 3328 KB |
test_11.txt | AC | 108 ms | 9984 KB |
test_12.txt | AC | 108 ms | 9984 KB |
test_13.txt | AC | 108 ms | 9984 KB |
test_14.txt | AC | 109 ms | 9984 KB |
test_15.txt | AC | 112 ms | 9984 KB |
test_16.txt | AC | 109 ms | 9984 KB |
test_17.txt | AC | 118 ms | 9984 KB |
test_18.txt | AC | 116 ms | 9984 KB |
test_19.txt | AC | 108 ms | 9984 KB |
test_20.txt | AC | 102 ms | 9984 KB |
test_21.txt | WA | 108 ms | 9984 KB |
test_22.txt | WA | 109 ms | 9984 KB |
test_23.txt | WA | 95 ms | 8576 KB |
test_24.txt | WA | 88 ms | 9216 KB |
test_25.txt | WA | 107 ms | 9088 KB |
test_26.txt | WA | 108 ms | 9088 KB |
test_27.txt | WA | 124 ms | 9088 KB |
test_28.txt | AC | 2 ms | 3328 KB |
test_29.txt | AC | 2 ms | 3328 KB |
test_30.txt | AC | 2 ms | 3328 KB |
test_31.txt | AC | 2 ms | 3328 KB |
test_32.txt | AC | 2 ms | 3328 KB |