Submission #1440275
Source Code Expand
/* 专 业 爆 搜 --InterestingLSY */ #include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <stack> #include <queue> #include <algorithm> #include <set> #include <map> #define pb push_back #define mp make_pair #define INF 9999999 #define LINF 9999999999999999 #define SINF "%" #define uint unsigned int #define msn(a,v) memset(a,v,sizeof(a)) #define ms(a) msn(a,0) #define NONE -1 #define ll long long #define ull unsigned ll #define uchar unsigned char #define sint short int #define usint unsigned sint #define xsize(a) sizeof(a)/1024/1024 #define fr(aaaaa,bbbbb) for(aaaaa = 1;aaaaa <= bbbbb;aaaaa++) #define frr(aaaaa,bbbbb,ccccc) for(aaaaa = ccccc;aaaaa <= bbbbb;aaaaa++) using namespace std; #define MAXN 100100 char s[MAXN]; int n; string ss[5]; int lens[5]; bool kmp(int pos,int id){ for(int i = 0;i < lens[id];i++){ if(s[pos+i] != ss[id][i]) return 0; } return 1; } bool dp[MAXN]; bool dfs(int pos){ if(pos == n) return 1; bool ans = 0; for(int i = 1;i <= 4;i++) if(pos + i < n && kmp(pos,i)){ ans = dfs(pos + lens[i]); if(ans) return 1; } return 0; } int main(){ //freopen("C.txt","r",stdin); ss[1] = "dream"; ss[2] = "dreamer"; ss[3] = "erase"; ss[4] = "eraser"; for(int i = 1;i <= 4;i++) lens[i] = ss[i].length(); scanf("%s",&s); n = strlen(s); if(dfs(0)) printf("YES\n"); else printf("NO\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Daydream |
User | vjudge1 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1419 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 896 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:68:15: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[100100]’ [-Wformat=] scanf("%s",&s); ^ ./Main.cpp:68:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",&s); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
All | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_0.txt | AC | 1 ms | 256 KB |
subtask0_1.txt | AC | 1 ms | 256 KB |
subtask0_2.txt | AC | 1 ms | 256 KB |
subtask1_0.txt | AC | 2 ms | 512 KB |
subtask1_1.txt | AC | 2 ms | 512 KB |
subtask1_10.txt | AC | 2 ms | 896 KB |
subtask1_11.txt | AC | 2 ms | 896 KB |
subtask1_12.txt | AC | 2 ms | 896 KB |
subtask1_13.txt | AC | 2 ms | 896 KB |
subtask1_14.txt | AC | 2 ms | 640 KB |
subtask1_15.txt | AC | 2 ms | 512 KB |
subtask1_2.txt | AC | 3 ms | 768 KB |
subtask1_3.txt | AC | 2 ms | 896 KB |
subtask1_4.txt | AC | 2 ms | 384 KB |
subtask1_5.txt | AC | 2 ms | 896 KB |
subtask1_6.txt | AC | 2 ms | 384 KB |
subtask1_7.txt | AC | 2 ms | 384 KB |
subtask1_8.txt | AC | 2 ms | 896 KB |
subtask1_9.txt | AC | 2 ms | 896 KB |