真相只有一个,那就是~~评测炸了~~
by Eric_lerk @ 2020-02-20 18:48:32
@[YCE3216037](/user/181378) 发一下代码,也许是您的某些变量名与某些库里的函数名重名了
by twelveZ @ 2020-02-20 18:48:47
你可能使用了奇怪的变量名
by LCGUO @ 2020-02-20 18:49:09
### 这是CE代码:
```cpp
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 100000 + 10;
FILE *fin, *fout;
inline int read(int &x) {
char c = 0; int f = x = 0;
while (c < 48 || c > 57) {
if (c == -1) return 0;
if (c == '-') f = 1; c = fgetc(fin);
}
while (c > 47 && c < 58) x = (x << 3) + (x << 1) + (c & 15), c = fgetc(fin);
if (f) x = -x; return 1;
}
inline int write(int x) {
if (x < 0) return putchar(45), write(-x);
if (x > 9) write(x / 10);
return fputc((x % 10) | 48, fout), 1;
}
inline int write(char c) {
return fputc(c, fout), 1;
}
template<class T, class... Args> inline int write(T x, Args... args) {
return write(x) + write(args...);
}
inline void move(int& x) {
x = (x + 1) & 3;
}
template<class T, class... Args> inline void move(T& x, Args&... args) {
move(x), move(args...);
}
int tot = 37, a[3][3], ans[37], temp[37];
inline int judge() {
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
if (a[i][j]) return 0;
return 1;
}
inline void work1() {
move(a[0][0], a[0][1], a[1][0], a[1][1]);
}
inline void work2() {
move(a[0][0], a[0][1], a[0][2]);
}
inline void work3() {
move(a[0][1], a[0][2], a[1][1], a[1][2]);
}
inline void work4() {
move(a[0][0], a[1][0], a[2][0]);
}
inline void work5() {
move(a[0][1], a[1][0], a[1][1], a[1][2], a[2][1]);
}
inline void work6() {
move(a[0][2], a[1][2], a[2][2]);
}
inline void work7() {
move(a[1][0], a[1][1], a[2][0], a[2][1]);
}
inline void work8() {
move(a[2][0], a[2][1], a[2][2]);
}
inline void work9() {
move(a[1][1], a[1][2], a[2][1], a[2][2]);
}
inline void work(int x) {
switch(x) {
case 1: work1(); return;
case 2: work2(); return;
case 3: work3(); return;
case 4: work4(); return;
case 5: work5(); return;
case 6: work6(); return;
case 7: work7(); return;
case 8: work8(); return;
case 9: work9(); return;
}
}
void dfs(int x, int dep, int tim) {
if (dep > tot) return;
if (judge()) {
if (dep < tot)
tot = dep, memcpy(ans, temp, sizeof(temp));
return;
}
if (x > 9) return;
dfs(x + 1, dep, 0);
if (tim > 2) return;
work(x), temp[dep + 1] = x;
dfs(x, dep + 1, tim + 1);
work(x), work(x), work(x), temp[dep + 1] = 0;
}
signed main() {
#ifdef ONLINE_JUDGE
fin = stdin;
fout = stdout;
#else
fin = fopen("P1213.in", "rb");
fout = fopen("P1213.out", "wb");
#endif
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
read(a[i][j]), a[i][j] = (a[i][j] / 3) & 3;
dfs(1, 0, 0);
for (int i = 1; i <= tot; ++i) write(ans[i], ' ');
return 0;
}
```
### AC代码:
将
```cpp
#include<bits/stdc++.h>
```
改为
```cpp
#include<cstdio>
#include<cstring>
```
by Alarm5854 @ 2020-02-20 18:50:46
万能头文件有些地方不支持
by USER113968 @ 2020-02-20 18:51:41
我觉得问题出在`move`函数
by Alarm5854 @ 2020-02-20 18:52:07
@[YCE3216037](/user/181378) 重名了,bits也给了一个move函数
by syksykCCC @ 2020-02-20 18:58:15
是我菜了,恕我帮不了你
by LCGUO @ 2020-02-20 18:58:42
@[syksykCCC](/user/51971) 以后不敢用万能头了。
by Alarm5854 @ 2020-02-20 18:59:14
@[YCE3216037](/user/181378) 首字母全部大写,去年CSP我就是这样过来的
by LCGUO @ 2020-02-20 19:10:13