# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1016607 |
2024-07-08T09:01:58 Z |
ByeWorld |
Topical (NOI23_topical) |
C++14 |
|
612 ms |
148500 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#define ll long long
#define int long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii, int> ipii;
const int MAXN = 5e5+10;
const int MAXA = 2e3+10;
const int INF = 1e18+10;
const int LOG = 19;
const int MOD = 1e9+7;
const int SQRT = 450;
const vector<int> NOL = {};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const vector<int> dx = {1, -1, 0, 0};
const vector<int> dy = {0, 0, 1, -1};
void chmx(int &a, int b){ a = max(a, b); }
int n, k;
signed main(){
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> k;
vector <int> te(k+1, 0);
vector <vector<int>> u(n+1, te), r(n+1, te);
vector <int> nw(k+1, 0); vector <int> done(n+1, 0);
vector<pii>pp;
vector<vector<pii>> vec(k+1, pp);
for(int i=1; i<=n; i++){
for(int j=1; j<=k; j++){
cin >> r[i][j];
vec[j].pb({r[i][j], i});
}
}
for(int j=1; j<=k; j++) sort(vec[j].rbegin(), vec[j].rend());
for(int i=1; i<=n; i++){
for(int j=1; j<=k; j++){
cin >> u[i][j];
}
}
bool can = 1;
int ANS = 0;
while(can){
can = 0;
// cout << " pp\n";
for(int j=1; j<=k; j++){
while(!vec[j].empty() && vec[j].back().fi <= nw[j]){
int idx = vec[j].back().se;
done[idx]++;
if(done[idx] == k){
can = 1; ANS++;
for(int p=1; p<=k; p++) nw[p] += u[idx][p];
}
vec[j].pop_back();
}
}
}
cout << ANS << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
1336 KB |
Output is correct |
4 |
Correct |
366 ms |
102012 KB |
Output is correct |
5 |
Correct |
380 ms |
101968 KB |
Output is correct |
6 |
Correct |
386 ms |
102224 KB |
Output is correct |
7 |
Correct |
267 ms |
102012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
6 ms |
860 KB |
Output is correct |
8 |
Correct |
5 ms |
1016 KB |
Output is correct |
9 |
Correct |
4 ms |
768 KB |
Output is correct |
10 |
Correct |
5 ms |
860 KB |
Output is correct |
11 |
Correct |
7 ms |
1168 KB |
Output is correct |
12 |
Correct |
5 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
6 ms |
2140 KB |
Output is correct |
4 |
Correct |
56 ms |
15192 KB |
Output is correct |
5 |
Correct |
53 ms |
15008 KB |
Output is correct |
6 |
Correct |
572 ms |
148500 KB |
Output is correct |
7 |
Correct |
612 ms |
146928 KB |
Output is correct |
8 |
Correct |
568 ms |
148492 KB |
Output is correct |
9 |
Correct |
527 ms |
146968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
1336 KB |
Output is correct |
4 |
Correct |
366 ms |
102012 KB |
Output is correct |
5 |
Correct |
380 ms |
101968 KB |
Output is correct |
6 |
Correct |
386 ms |
102224 KB |
Output is correct |
7 |
Correct |
267 ms |
102012 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
6 ms |
860 KB |
Output is correct |
15 |
Correct |
5 ms |
1016 KB |
Output is correct |
16 |
Correct |
4 ms |
768 KB |
Output is correct |
17 |
Correct |
5 ms |
860 KB |
Output is correct |
18 |
Correct |
7 ms |
1168 KB |
Output is correct |
19 |
Correct |
5 ms |
860 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
6 ms |
2140 KB |
Output is correct |
23 |
Correct |
56 ms |
15192 KB |
Output is correct |
24 |
Correct |
53 ms |
15008 KB |
Output is correct |
25 |
Correct |
572 ms |
148500 KB |
Output is correct |
26 |
Correct |
612 ms |
146928 KB |
Output is correct |
27 |
Correct |
568 ms |
148492 KB |
Output is correct |
28 |
Correct |
527 ms |
146968 KB |
Output is correct |
29 |
Correct |
496 ms |
54864 KB |
Output is correct |
30 |
Correct |
480 ms |
49488 KB |
Output is correct |
31 |
Correct |
490 ms |
55668 KB |
Output is correct |
32 |
Correct |
315 ms |
45500 KB |
Output is correct |
33 |
Correct |
345 ms |
42288 KB |
Output is correct |
34 |
Correct |
365 ms |
45312 KB |
Output is correct |
35 |
Correct |
426 ms |
52232 KB |
Output is correct |
36 |
Correct |
411 ms |
48372 KB |
Output is correct |
37 |
Correct |
498 ms |
51320 KB |
Output is correct |
38 |
Correct |
243 ms |
44576 KB |
Output is correct |