QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#275189 | #6646. 物理实验 | rageOfThunder# | WA | 3ms | 4412kb | C++14 | 1.8kb | 2023-12-04 14:48:34 | 2023-12-04 14:48:35 |
Judging History
answer
// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "[" << __LINE__ << "] "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> inline void chkmax(T& x, T y) {x = max(x, y);}
template <typename T> inline void chkmin(T& x, T y) {x = min(x, y);}
template <typename T> inline void read(T &x) {
x = 0; int f = 1; char c = getchar();
for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
x *= f;
}
const int N = 610;
int n, a[N], m, p[N][N], id[N], ss;
bool vis[N], vv[N];
bool check() {
F(i, 1, n) vv[i] = true;
int res = 0;
F(i, 1, n - m) {
res++;
if (id[i]) {
F(j, 1, n) {
if (vis[p[i][j]]) {
if (vv[p[i][j]]) {
if (--res < 0) {
// debug << "fuck"
return false;
}
vv[p[i][j]] = false;
}
} else break;
}
}
}
return true;
}
void doit() {
F(i, 1, n) vv[i] = true;
F(i, 1, n - m) {
if (id[i]) {
F(j, 1, n) {
if (vis[p[i][j]]) {
if (vv[p[i][j]]) {
cout << p[i][j] << ' ';
vv[p[i][j]] = false;
}
} else break;
}
}
}
F(i, 1, n)
if (vis[i] && vv[i]) cout << i << ' ';
}
signed main() {
read(n), read(m);
F(i, 1, m) read(a[i]), id[a[i]] = i;
F(i, 1, m)
F(j, 1, n)
read(p[i][j]);
// debug << "OK\n";
F(i, 1, n) {
vis[i] = true;
// debug << i << endl;
if (++ss > n - m || !check()) vis[i] = false, ss--;
}
// F(i, 1, n)
// if (vis[i]) cout << i << " "; cout << endl;
doit();
return 0;
}
/* why?
*/
详细
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 4412kb
input:
600 299 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...
output:
9 17 65 44 111 207 116 101 42 280 229 41 117 139 171 244 272 199 27 36 191 94 136 99 83 235 178 226 270 82 43 104 95 188 202 291 131 187 112 151 281 166 200 3 258 246 301 70 147 163 194 198 206 114 303 245 29 282 227 15 267 127 119 120 263 84 160 148 46 184 4 92 144 209 262 243 279 190 231 195 90 29...
result:
FAIL Method Invalid.