QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#275190#6646. 物理实验rageOfThunder#WA 4ms4144kbC++141.9kb2023-12-04 14:51:562023-12-04 14:51:57

Judging History

你现在查看的是最新测评结果

  • [2023-12-04 14:51:57]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:4144kb
  • [2023-12-04 14:51:56]
  • 提交

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[id[i]][j]]) {
					if (vv[p[id[i]][j]]) {
						if (--res < 0) {
							// debug << "fuck"
							return false;
						}
						vv[p[id[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[id[i]][j]]) {
					if (vv[p[id[i]][j]]) {
						// debug << i << " " << j << endl;
						cout << p[id[i]][j] << ' ';
						vv[p[id[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: 4ms
memory: 4144kb

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.