QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#80267 | #3836. So I'll Max Out My Constructive Algorithm Skills | darielangel | Compile Error | / | / | C++17 | 1.5kb | 2023-02-23 12:08:04 | 2023-02-23 12:08:05 |
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:08:05]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-02-23 12:08:04]
- 提交
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]);
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;
}
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");
}
}
详细
answer.code: In function ‘void dfs(int, int)’: answer.code:20:9: error: reference to ‘visit’ is ambiguous 20 | 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:43:20: error: reference to ‘visit’ is ambiguous 43 | 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:57:9: error: reference to ‘visit’ is ambiguous 57 | 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:87:30: error: reference to ‘visit’ is ambiguous 87 | 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:87:36: error: reference to ‘visit’ is ambiguous 87 | 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]; | ^~~~~