Submission #1177975
Source Code Expand
#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<cstdio> #include<cmath> #include<cstdlib> #include<ctime> #include<queue> #include<set> #define md double #define LL long long using namespace std; const int N=1e6; int gi() { int w=0;bool q=1;char c=getchar(); while ((c<'0'||c>'9') && c!='-') c=getchar(); if (c=='-') q=0,c=getchar(); while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar(); return q? w:-w; } int str[N]; int nxt[N][27],ST[N][21]; int main() { int n=0,i,m,t,l,r;char c; while ((c=getchar())<'a'||'z'<c); while ('a'<=c&&c<='z') str[++n]=c-'a',c=getchar(); for (i=n;i;i--) { nxt[i][str[i]]=i+1; for (t=str[i];t<26;t++) nxt[i][t+1]=nxt[nxt[i][t]][t]; for (t=0;t<str[i];t++) nxt[i][t]=nxt[nxt[i][26]][t]; ST[i][0]=nxt[i][26]; } for (t=0;t<20;t++) for (i=n-(1<<(t+1));i>0;i--) ST[i][t+1]=ST[ST[i][t]][t]; m=gi(); while (m--) { l=gi(),r=gi()+1; for (t=0;ST[l][t]&&ST[l][t]<=r;t++); while (--t>=0) if (ST[l][t]&&ST[l][t]<=r) l=ST[l][t]; puts(l==r?"Yes":"No"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Robot Racing |
User | laofu |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1087 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | Subtask | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | 0 / 400 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
Subtask | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 2_00.txt, 2_01.txt, 2_02.txt, 2_03.txt, 2_04.txt, 2_05.txt, 2_06.txt, 2_07.txt, 2_08.txt, 2_09.txt, 2_10.txt, 2_11.txt, 2_12.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | TLE | 2103 ms | 256 KB |
0_01.txt | TLE | 2103 ms | 256 KB |
0_02.txt | TLE | 2103 ms | 256 KB |
0_03.txt | TLE | 2103 ms | 256 KB |
1_00.txt | TLE | 2103 ms | 256 KB |
1_01.txt | TLE | 2103 ms | 256 KB |
1_02.txt | TLE | 2103 ms | 256 KB |
1_03.txt | TLE | 2103 ms | 256 KB |
1_04.txt | TLE | 2103 ms | 256 KB |
1_05.txt | TLE | 2103 ms | 256 KB |
1_06.txt | TLE | 2103 ms | 256 KB |
1_07.txt | TLE | 2103 ms | 256 KB |
1_08.txt | TLE | 2103 ms | 256 KB |
1_09.txt | TLE | 2103 ms | 256 KB |
1_10.txt | TLE | 2103 ms | 256 KB |
2_00.txt | TLE | 2103 ms | 256 KB |
2_01.txt | TLE | 2103 ms | 256 KB |
2_02.txt | TLE | 2103 ms | 256 KB |
2_03.txt | TLE | 2103 ms | 256 KB |
2_04.txt | TLE | 2103 ms | 256 KB |
2_05.txt | TLE | 2103 ms | 256 KB |
2_06.txt | TLE | 2103 ms | 256 KB |
2_07.txt | TLE | 2103 ms | 256 KB |
2_08.txt | TLE | 2103 ms | 256 KB |
2_09.txt | TLE | 2103 ms | 256 KB |
2_10.txt | TLE | 2103 ms | 256 KB |
2_11.txt | TLE | 2103 ms | 256 KB |
2_12.txt | TLE | 2103 ms | 256 KB |