QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244449 | #6506. Chase Game 3 | uicere | Compile Error | / | / | C++14 | 1.4kb | 2023-11-09 08:11:24 | 2023-11-09 08:11:25 |
Judging History
answer
#include<iostream>
#include<vector>
using namespace std;
const int N=4e5+8;
int p[N];
bool dgz[N],dgy[N];
vector<int> e[N];
void solve(){
int n;cin>>n;
for(int i=1;i<=n;i++){
dgz[i]=dgy[i]=0;
e[i].clear();
}
for(int i=1;i<=n;i++) cin>>p[i];
if(n<=3){
puts("Yes");
return ;
}
for(int i=1;i<n;i++){
e[p[i]].push_back(p[i+1]);
e[p[i+1]].push_back(p[i]);
}
for(int i=1;i<=n;i++){
for(auto v:e[i]){
if(v<i) dgz[i]=true;
if(v>i) dgy[i]=true;
}
if(i==1){
if(dgy[i]) continue;
else {puts("No");return ;}
}
else if(i==n){
if(dgz[i]) continue;
else {puts("No");return ;}
}
else if(dgz[i]&&dgy[i]) continue;
else{puts("No");return ;}
}
puts("Yes");
return ;
}
int main(){
int T;
cin>>T;
while(T--) solve();
return 0;
}#include<iostream>
#include<cstring>
using namespace std;
const int N=4e5+8;
int p[N],v[N];
void solve(){
int n;cin>>n;
for(int i=1;i<=n;i++) cin>>p[i],v[p[i]]=i;
for(int i=1;i<n;i++){
if(abs(p[i]-p[i+1])){
puts("No");
return ;
}
}
puts("Yes");
return ;
}
int main(){
int T;
cin>>T;
while(T--) solve();
return 0;
}
Details
answer.code:47:2: error: stray ‘#’ in program 47 | }#include<iostream> | ^ answer.code:47:3: error: ‘include’ does not name a type 47 | }#include<iostream> | ^~~~~~~ In file included from answer.code:48: /usr/include/c++/11/cstring:77:11: error: ‘memchr’ has not been declared in ‘::’ 77 | using ::memchr; | ^~~~~~ /usr/include/c++/11/cstring:78:11: error: ‘memcmp’ has not been declared in ‘::’ 78 | using ::memcmp; | ^~~~~~ /usr/include/c++/11/cstring:79:11: error: ‘memcpy’ has not been declared in ‘::’ 79 | using ::memcpy; | ^~~~~~ /usr/include/c++/11/cstring:80:11: error: ‘memmove’ has not been declared in ‘::’ 80 | using ::memmove; | ^~~~~~~ /usr/include/c++/11/cstring:81:11: error: ‘memset’ has not been declared in ‘::’ 81 | using ::memset; | ^~~~~~ /usr/include/c++/11/cstring:82:11: error: ‘strcat’ has not been declared in ‘::’ 82 | using ::strcat; | ^~~~~~ /usr/include/c++/11/cstring:83:11: error: ‘strcmp’ has not been declared in ‘::’ 83 | using ::strcmp; | ^~~~~~ /usr/include/c++/11/cstring:84:11: error: ‘strcoll’ has not been declared in ‘::’ 84 | using ::strcoll; | ^~~~~~~ /usr/include/c++/11/cstring:85:11: error: ‘strcpy’ has not been declared in ‘::’ 85 | using ::strcpy; | ^~~~~~ /usr/include/c++/11/cstring:86:11: error: ‘strcspn’ has not been declared in ‘::’ 86 | using ::strcspn; | ^~~~~~~ /usr/include/c++/11/cstring:87:11: error: ‘strerror’ has not been declared in ‘::’ 87 | using ::strerror; | ^~~~~~~~ /usr/include/c++/11/cstring:88:11: error: ‘strlen’ has not been declared in ‘::’ 88 | using ::strlen; | ^~~~~~ /usr/include/c++/11/cstring:89:11: error: ‘strncat’ has not been declared in ‘::’ 89 | using ::strncat; | ^~~~~~~ /usr/include/c++/11/cstring:90:11: error: ‘strncmp’ has not been declared in ‘::’ 90 | using ::strncmp; | ^~~~~~~ /usr/include/c++/11/cstring:91:11: error: ‘strncpy’ has not been declared in ‘::’ 91 | using ::strncpy; | ^~~~~~~ /usr/include/c++/11/cstring:92:11: error: ‘strspn’ has not been declared in ‘::’ 92 | using ::strspn; | ^~~~~~ /usr/include/c++/11/cstring:93:11: error: ‘strtok’ has not been declared in ‘::’ 93 | using ::strtok; | ^~~~~~ /usr/include/c++/11/cstring:94:11: error: ‘strxfrm’ has not been declared in ‘::’ 94 | using ::strxfrm; | ^~~~~~~ /usr/include/c++/11/cstring:95:11: error: ‘strchr’ has not been declared in ‘::’ 95 | using ::strchr; | ^~~~~~ /usr/include/c++/11/cstring:96:11: error: ‘strpbrk’ has not been declared in ‘::’ 96 | using ::strpbrk; | ^~~~~~~ /usr/include/c++/11/cstring:97:11: error: ‘strrchr’ has not been declared in ‘::’ 97 | using ::strrchr; | ^~~~~~~ /usr/include/c++/11/cstring:98:11: error: ‘strstr’ has not been declared in ‘::’ 98 | using ::strstr; | ^~~~~~ answer.code:50:11: error: redefinition of ‘const int N’ 50 | const int N=4e5+8; | ^ answer.code:4:11: note: ‘const int N’ previously defined here 4 | const int N=4e5+8; | ^ answer.code:51:5: error: redefinition of ‘int p [400008]’ 51 | int p[N],v[N]; | ^ answer.code:5:5: note: ‘int p [400008]’ previously declared here 5 | int p[N]; | ^ answer.code:52:6: error: redefinition of ‘void solve()’ 52 | void solve(){ | ^~~~~ answer.code:8:6: note: ‘void solve()’ previously defined here 8 | void solve(){ | ^~~~~ answer.code:64:5: error: redefinition of ‘int main()’ 64 | int main(){ | ^~~~ answer.code:42:5: note: ‘int main()’ previously defined here 42 | int main(){ | ^~~~