1 条题解
-
2
头文件就亿点点多
#include <map> #include <cstdlib> #include <cmath> #include <cstdio> #include <string> #include <cstring> #include <fstream> #include <iostream> #include <algorithm> #define fori(a) for(int i=0;i<a;i++) #define forj(a) for(int j=0;j<a;j++) #define ifor(a) for(int i=1;i<=a;i++) #define jfor(a) for(int j=1;j<=a;j++) #define IO do{\ ios::sync_with_stdio(false);\ cin.tie(0);\ cout.tie(0);}while(0) #define mp(a,b) make_pair(a,b) using namespace std; typedef long long ll; const int maxn = 210; map <pair<int,int>,bool>q; pair <int,int >buf; map <int,bool>res; int cnt; int ans[maxn]; int dir[6][2]= {{0,2},{0,2},{1,2},{1,0},{2,0},{2,1}}; int v[3]; int w[3]; int push(int a,int b) {return min(w[a],v[b]-w[b]);} void dfs() { if(w[0]==0&&!res[w[2]]) { ans[cnt++] = w[2]; res[w[2]] = true; } fori(6) { int val = push(dir[i][0],dir[i][1]); if(val) { int a = dir[i][0]; int b = dir[i][1]; w[a] -= val; w[b] += val; buf = mp(w[0],w[1]); if(!q[buf]) { q[buf]=true; dfs(); } w[a]+=val; w[b]-=val; } } } int main() { fori(3) cin >> v[i]; w[2] = v[2]; dfs(); sort(ans,ans+cnt); fori(cnt){ if(i) cout <<" "; cout << ans[i]; } cout << endl; return 0; }
- 1
信息
- ID
- 19
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- 递交数
- 19
- 已通过
- 4
- 上传者