QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#80264 | #3836. So I'll Max Out My Constructive Algorithm Skills | darielangel | Compile Error | / | / | C++17 | 1.5kb | 2023-02-23 12:06:34 | 2023-02-23 12:06:37 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-02-23 12:06:37]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-02-23 12:06:34]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
int t,n;
int M[64][64];
int S[64][64];
int B[64][64];
long long visit[64];
bool ok;
int x[4]= {-1,0,1,0};
int y[4]= {0,1,0,-1};
vector<int>ans;
struct st{
int F,S,V;
}vec[64*64];
void dfs(int a, int b){
ans.push_back(M[a][b]);
V[a][b]=1;
visit[a] |= (1<<b);
/*cout<<"-> "<<S[a][b]<<" : "<<B[a][b]<<'\n';
for(int i=0;i<ans.size();i++){
cout<<ans[i];
if(i<ans.size()-1)cout<<' ';
}cout<<'\n';*/
if(ans.size() == n*n){
if(S[a][b]>=B[a][b]){
ok=1;
}
return;
}
int nx,ny;
for(int i=0;i<4;i++){
nx = a+x[i];
ny = b+y[i];
if(nx<0||ny<0||nx==n||ny==n)continue;
if(visit[nx] & (1<<ny))continue;
if(M[a][b] >= M[nx][ny]){
S[nx][ny] = S[a][b]+1;
B[nx][ny] = B[a][b];
} else {
S[nx][ny] = S[a][b];
B[nx][ny] = B[a][b]+1;
}
dfs(nx,ny);
if(ok)return;
}
V[a][b]=0;
visit[a] ^= (1<<b);
ans.pop_back();
}
bool sort(st a, st b){
return a.V > b.V;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>t;
while(t--) {
cin>>n;
int c=0;
for(int i=0; i<n; i++)
for(int j=0; j<n; j++) {
cin>>M[i][j];
vec[c].F = i;
vec[c].S = j;
vec[c++].V = M[i][j];
}
ok=0;
for(int i=0;i<n*n;i++){
ans.clear();
fill(visit,visit+n,0);
dfs(vec[i].F,vec[i].S);
if(ok)break;
}
for(int i=0;i<ans.size();i++){
printf("%d",ans[i]);
if(i<ans.size()-1)printf(" ");
}printf("\n");
}
}
Details
answer.code: In function ‘void dfs(int, int)’: answer.code:20:9: error: ‘V’ was not declared in this scope 20 | V[a][b]=1; | ^ answer.code:21:9: error: reference to ‘visit’ is ambiguous 21 | visit[a] |= (1<<b); | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133, from answer.code:1: /usr/include/c++/11/variant:1740:5: note: candidates are: ‘template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)’ 1740 | visit(_Visitor&& __visitor, _Variants&&... __variants) | ^~~~~ answer.code:8:11: note: ‘long long int visit [64]’ 8 | long long visit[64]; | ^~~~~ answer.code:44:20: error: reference to ‘visit’ is ambiguous 44 | if(visit[nx] & (1<<ny))continue; | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133, from answer.code:1: /usr/include/c++/11/variant:1740:5: note: candidates are: ‘template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)’ 1740 | visit(_Visitor&& __visitor, _Variants&&... __variants) | ^~~~~ answer.code:8:11: note: ‘long long int visit [64]’ 8 | long long visit[64]; | ^~~~~ answer.code:59:9: error: reference to ‘visit’ is ambiguous 59 | visit[a] ^= (1<<b); | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133, from answer.code:1: /usr/include/c++/11/variant:1740:5: note: candidates are: ‘template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)’ 1740 | visit(_Visitor&& __visitor, _Variants&&... __variants) | ^~~~~ answer.code:8:11: note: ‘long long int visit [64]’ 8 | long long visit[64]; | ^~~~~ answer.code: In function ‘int main()’: answer.code:89:30: error: reference to ‘visit’ is ambiguous 89 | fill(visit,visit+n,0); | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133, from answer.code:1: /usr/include/c++/11/variant:1740:5: note: candidates are: ‘template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)’ 1740 | visit(_Visitor&& __visitor, _Variants&&... __variants) | ^~~~~ answer.code:8:11: note: ‘long long int visit [64]’ 8 | long long visit[64]; | ^~~~~ answer.code:89:36: error: reference to ‘visit’ is ambiguous 89 | fill(visit,visit+n,0); | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:133, from answer.code:1: /usr/include/c++/11/variant:1740:5: note: candidates are: ‘template<class _Visitor, class ... _Variants> constexpr decltype(auto) std::visit(_Visitor&&, _Variants&& ...)’ 1740 | visit(_Visitor&& __visitor, _Variants&&... __variants) | ^~~~~ answer.code:8:11: note: ‘long long int visit [64]’ 8 | long long visit[64]; | ^~~~~