답안 #933079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
933079 2024-02-25T01:24:49 Z Jasonwei08 Topical (NOI23_topical) C++14
28 / 100
365 ms 246768 KB
#include <bits/stdc++.h>
#define int long long
#define re(a, b, c, d) for (auto a = b; a <= c; a += d)
#define de(a, b, c, d) for (auto a = b; a >= c; a -= d)
#define ms (a); memset (a, 0, sizeof a);
#define imax INT_MAX
#define imin INT_MIN
#define wh(a) while (a --)
#define PII pair <int, int>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
template <typename T> bool chkmin (T &a, T b) {
	return (b < a) ? a = b, 1 : 0;
}
template <typename T> bool chkmax (T &a, T b) {
	return (b > a) ? a = b, 1 : 0;
}
using namespace std;
const int N = 1e5 + 5;
int T, n, k, c[N], d[N], f[N];
vector <PII> g[N];
signed main () {
	cout << fixed << setprecision (0);
	ios :: sync_with_stdio (0), cin.tie (0), cout.tie (0);
	cin >> n >> k;
	int a[n + 5][k + 5], b[n + 5][k + 5];
	re (i, 1, n, 1) re (j, 1, k, 1) cin >> a[i][j], g[j].pb ({a[i][j], i});
	re (i, 1, n, 1) re (j, 1, k, 1) cin >> b[i][j];
	re (i, 1, k, 1)sort (g[i].begin(), g[i].end());
	int res = 0;
	while (1) {
		int fl = 0;
		re (i, 1, k, 1) {
			while (1) {
				if (c[i] >= n || f[i] < g[i][c[i]].F) break;
				int h = g[i][c[i]].S;
				d[h]++;
				if (d[h] == k) {
					re (j, 1, k, 1)	f[j] += b[h][j];
					fl = 1;
					res++;
				}
				c[i]++;
			}
		}
		if (! fl) break;
	}
	cout << res;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4700 KB Output is correct
3 Correct 3 ms 5976 KB Output is correct
4 Runtime error 154 ms 213820 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4736 KB Output is correct
3 Correct 1 ms 4696 KB Output is correct
4 Correct 1 ms 4700 KB Output is correct
5 Correct 1 ms 4700 KB Output is correct
6 Correct 1 ms 4700 KB Output is correct
7 Correct 4 ms 5080 KB Output is correct
8 Correct 3 ms 5320 KB Output is correct
9 Correct 3 ms 5212 KB Output is correct
10 Correct 4 ms 5096 KB Output is correct
11 Correct 3 ms 5212 KB Output is correct
12 Correct 3 ms 5212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4700 KB Output is correct
3 Correct 4 ms 6236 KB Output is correct
4 Correct 30 ms 17112 KB Output is correct
5 Correct 28 ms 16856 KB Output is correct
6 Runtime error 365 ms 246768 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Correct 1 ms 4700 KB Output is correct
3 Correct 3 ms 5976 KB Output is correct
4 Runtime error 154 ms 213820 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -