QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#603956 | #9350. Fixing Banners | Saton | Compile Error | / | / | C++20 | 2.8kb | 2024-10-01 21:16:20 | 2024-10-01 21:16:20 |
Judging History
answer
//by Saton.
#include<bits/stdc++.h>
#define PI acos(-1)
#define fi first
#define se second
#define sz(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define LL long long
#define ll __int128
#define DD double double
#define LD long double
#define rep(i,a,b) for(LL i = (a);i <= (b);i ++)
#define lep(i,a,b) for(LL i = (a);i >= (b);i --)
#define FLUSH fflush(stdout)
using namespace std;
const int N = 2e5 + 10,mod = 1e9+7,P = 131;
const LL inf = 1e9+10,INF = 1e18+10;
typedef pair<int,int> PII;
typedef pair<LL,int> PLI;
typedef pair<LL,LL> PLL;
LL n,m,k;
string str;
string target = " harbin";
bool a[7][7];
bool dfs(int step,int pos,int state) {
if(!a[pos][step]) return false;
if(step==6) return true;
bool ans = false;
rep(i,1,6) {
if(state>>i&1) continue;
ans |= dfs(step+1,i,state|(1<<i));
}
return ans;
}
void solve() {
rep(i,0,6) rep(j,0,6) a[i][j] = false;
rep(i,1,6) {
cin >> str;
rep(j,0,sz(str)-1) rep(k,1,6) a[i][k] |= (str[j]==target[k]);
}
bool ans = false;
rep(i,1,6) ans |= dfs(1,i,1<<i);
cout << (ans ? "Yes" : "No") << '\n';
}
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T;
cin >> T;
while(T --) {
solve();
}
// solve();
return 0;
}
/* /\_/\
* (= ._.)
* / > \>
*////by Saton.
#include<bits/stdc++.h>
#define PI acos(-1)
#define fi first
#define se second
#define sz(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define LL long long
#define ll __int128
#define DD double double
#define LD long double
#define rep(i,a,b) for(LL i = (a);i <= (b);i ++)
#define lep(i,a,b) for(LL i = (a);i >= (b);i --)
#define FLUSH fflush(stdout)
using namespace std;
const int N = 2e5 + 10,mod = 1e9+7,P = 131;
const LL inf = 1e9+10,INF = 1e18+10;
typedef pair<int,int> PII;
typedef pair<LL,int> PLI;
typedef pair<LL,LL> PLL;
LL n,m,k;
string str;
string target = " harbin";
bool a[7][7];
bool dfs(int step,int pos,int state) {
if(step==7) return true;
if(!a[pos][step]) return false;
bool ans = false;
rep(i,1,6) {
if((state>>i&1) && step<6) continue;
ans |= dfs(step+1,i,state|(1<<i));
}
return ans;
}
void solve() {
rep(i,0,6) rep(j,0,6) a[i][j] = false;
rep(i,1,6) {
cin >> str;
rep(j,0,sz(str)-1) rep(k,1,6) a[i][k] |= (str[j]==target[k]);
}
bool ans = false;
rep(i,1,6) ans |= dfs(1,i,1<<i);
cout << (ans ? "Yes" : "No") << '\n';
}
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T;
cin >> T;
while(T --) {
solve();
}
// solve();
return 0;
}
/* /\_/\
* (= ._.)
* / > \>
*/
详细
answer.code:79:11: error: redefinition of ‘const int N’ 79 | const int N = 2e5 + 10,mod = 1e9+7,P = 131; | ^ answer.code:16:11: note: ‘const int N’ previously defined here 16 | const int N = 2e5 + 10,mod = 1e9+7,P = 131; | ^ answer.code:79:24: error: redefinition of ‘const int mod’ 79 | const int N = 2e5 + 10,mod = 1e9+7,P = 131; | ^~~ answer.code:16:24: note: ‘const int mod’ previously defined here 16 | const int N = 2e5 + 10,mod = 1e9+7,P = 131; | ^~~ answer.code:79:37: error: redefinition of ‘const int P’ 79 | const int N = 2e5 + 10,mod = 1e9+7,P = 131; | ^ answer.code:16:37: note: ‘const int P’ previously defined here 16 | const int N = 2e5 + 10,mod = 1e9+7,P = 131; | ^ answer.code:80:10: error: redefinition of ‘const long long int inf’ 80 | const LL inf = 1e9+10,INF = 1e18+10; | ^~~ answer.code:17:10: note: ‘const long long int inf’ previously defined here 17 | const LL inf = 1e9+10,INF = 1e18+10; | ^~~ answer.code:80:23: error: redefinition of ‘const long long int INF’ 80 | const LL inf = 1e9+10,INF = 1e18+10; | ^~~ answer.code:17:23: note: ‘const long long int INF’ previously defined here 17 | const LL inf = 1e9+10,INF = 1e18+10; | ^~~ answer.code:84:4: error: redefinition of ‘long long int n’ 84 | LL n,m,k; | ^ answer.code:21:4: note: ‘long long int n’ previously declared here 21 | LL n,m,k; | ^ answer.code:84:6: error: redefinition of ‘long long int m’ 84 | LL n,m,k; | ^ answer.code:21:6: note: ‘long long int m’ previously declared here 21 | LL n,m,k; | ^ answer.code:84:8: error: redefinition of ‘long long int k’ 84 | LL n,m,k; | ^ answer.code:21:8: note: ‘long long int k’ previously declared here 21 | LL n,m,k; | ^ answer.code:85:8: error: redefinition of ‘std::string str’ 85 | string str; | ^~~ answer.code:22:8: note: ‘std::string str’ previously defined here 22 | string str; | ^~~ answer.code:86:8: error: redefinition of ‘std::string target’ 86 | string target = " harbin"; | ^~~~~~ answer.code:23:8: note: ‘std::string target’ previously defined here 23 | string target = " harbin"; | ^~~~~~ answer.code:87:6: error: redefinition of ‘bool a [7][7]’ 87 | bool a[7][7]; | ^ answer.code:24:6: note: ‘bool a [7][7]’ previously declared here 24 | bool a[7][7]; | ^ answer.code:88:6: error: redefinition of ‘bool dfs(int, int, int)’ 88 | bool dfs(int step,int pos,int state) { | ^~~ answer.code:25:6: note: ‘bool dfs(int, int, int)’ previously defined here 25 | bool dfs(int step,int pos,int state) { | ^~~ answer.code:100:6: error: redefinition of ‘void solve()’ 100 | void solve() { | ^~~~~ answer.code:37:6: note: ‘void solve()’ previously defined here 37 | void solve() { | ^~~~~ answer.code:113:5: error: redefinition of ‘int main()’ 113 | int main() { | ^~~~ answer.code:50:5: note: ‘int main()’ previously defined here 50 | int main() { | ^~~~