| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1328721 | Naa | Topical (NOI23_topical) | C++20 | 1096 ms | 23932 KiB |
#include <bits/stdc++.h>
using namespace std;
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
using i32 = long long;
#define all(a) (a).begin(), (a).end()
#define open(x) if(fopen(#x ".inp", "r")) {freopen(#x ".inp", "r", stdin); freopen(#x ".out", "w", stdout);}
template<class X, class Y> bool mimi(X &x, const Y &y) {if(x > y) {x = y; return 1;} return 0;}
template<class X, class Y> bool mama(X &x, const Y &y) {if(x < y) {x = y; return 1;} return 0;}
const i32 N = 1e6 + 5;
const i32 M = 1000000007;
const i32 inf = 1000000009;
const i32 infll = (i32)1000000000000000018;
vector<i32> r[N], u[N];
void sad(i32 testID) {
i32 n, k;
cin >> n >> k;
vector<vector<i32>> r(n, vector<i32>(k)), u(n, vector<i32>(k));
for(i32 i = 0; i < n; i ++)
for(i32 j = 0; j < k; j ++)
cin >> r[i][j];
for(i32 i = 0; i < n; i ++)
for(i32 j = 0; j < k; j ++)
cin >> u[i][j];
vector<i32> p(k, 0);
vector<bool> in(n, false);
i32 res = 0;
bool check = true;
while(check) {
check = false;
for(i32 i = 0; i < n; i ++) {
if(in[i]) continue;
bool ok = true;
for(i32 j = 0; j < k; j ++) if(p[j] < r[i][j]) {
ok = false;
break;
}
if(ok) {
in[i] = true; res ++;
check = true;
for(i32 j = 0; j < k; j ++) p[j] += u[i][j];
}
}
}
cout << res << endl;
}
signed main() {
auto begin = std::chrono::high_resolution_clock::now();
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
open(task)
i32 t = 1;
// cin >> t;
for(i32 testID = 1; testID <= t; testID++) {
// cout << "Case #" << testID << ":\n";
sad(testID);
}
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
// cerr << endl << "Time measured: " << elapsed.count() * 1e-9 << " seconds." << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
