# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1102404 | 2024-10-18T04:15:00 Z | LTTrungCHL | Topical (NOI23_topical) | C++17 | 303 ms | 92136 KB |
///***LTT***/// /// ->NHAT QUOC GIA<- /// #include<bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC optimize ("unroll-loops") //#pragma GCC target("popcnt") //#define int long long #define endl "\n" #define F first #define S second #define pb push_back using namespace std; vector <int> lg2; //void MAKE_LOG_ARR(int n){ // lg2.resize(n + 3); // for (int i = 1;i <= n;++i){ // lg2[i] = __lg(i); // } //} const long long oo = 1e9+7; const int N = 1e6 + 3; int n, k; vector <pair <int ,int>> in[N]; vector <int> a[N]; long long cur[N]; int cnt[N]; void solve(){ cin >> n >> k; for (int i = 1;i <= n;++i){ for (int j = 1;j <= k;++j){ int v; cin >> v; in[j].pb({v, i}); } } for (int i = 1;i <= n;++i){ a[i].pb(0); for (int j = 1;j <= k;++j){ int tmp; cin >> tmp; a[i].pb(tmp); } } for (int i = 1;i <= k;++i){ sort(in[i].begin(), in[i].end()); reverse(in[i].begin(), in[i].end()); } int gain = 0; while (1){ bool found = false; for (int i = 1;i <= k;++i){ while (!in[i].empty() and in[i].back().F <= cur[i]){ ++cnt[in[i].back().S]; if (cnt[in[i].back().S] == k){ found = true; for (int j = 1;j <= k;++j){ cur[j] += a[in[i].back().S][j]; cur[j] = min(cur[j], oo); } ++gain; } in[i].pop_back(); } } if (!found) break; } cout << gain; return; } int main(){ ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); if (fopen("ltt.inp", "r")){ freopen("ltt.inp", "r", stdin); freopen("ltt.out", "w", stdout); } // int t; // cin >> t; // while(t--){ solve(); // } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 48720 KB | Output is correct |
2 | Correct | 9 ms | 48720 KB | Output is correct |
3 | Correct | 12 ms | 48976 KB | Output is correct |
4 | Correct | 169 ms | 90576 KB | Output is correct |
5 | Correct | 170 ms | 90708 KB | Output is correct |
6 | Correct | 160 ms | 90548 KB | Output is correct |
7 | Correct | 130 ms | 86324 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 48720 KB | Output is correct |
2 | Correct | 8 ms | 48720 KB | Output is correct |
3 | Correct | 10 ms | 48740 KB | Output is correct |
4 | Correct | 9 ms | 48892 KB | Output is correct |
5 | Correct | 9 ms | 48720 KB | Output is correct |
6 | Correct | 9 ms | 48720 KB | Output is correct |
7 | Correct | 10 ms | 48732 KB | Output is correct |
8 | Correct | 13 ms | 48720 KB | Output is correct |
9 | Correct | 13 ms | 48720 KB | Output is correct |
10 | Correct | 11 ms | 48720 KB | Output is correct |
11 | Correct | 12 ms | 48932 KB | Output is correct |
12 | Correct | 11 ms | 48720 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 48720 KB | Output is correct |
2 | Correct | 10 ms | 48736 KB | Output is correct |
3 | Correct | 12 ms | 48976 KB | Output is correct |
4 | Correct | 37 ms | 54744 KB | Output is correct |
5 | Correct | 45 ms | 54868 KB | Output is correct |
6 | Correct | 303 ms | 92136 KB | Output is correct |
7 | Correct | 298 ms | 92080 KB | Output is correct |
8 | Correct | 297 ms | 91948 KB | Output is correct |
9 | Correct | 296 ms | 92080 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 48720 KB | Output is correct |
2 | Correct | 9 ms | 48720 KB | Output is correct |
3 | Correct | 12 ms | 48976 KB | Output is correct |
4 | Correct | 169 ms | 90576 KB | Output is correct |
5 | Correct | 170 ms | 90708 KB | Output is correct |
6 | Correct | 160 ms | 90548 KB | Output is correct |
7 | Correct | 130 ms | 86324 KB | Output is correct |
8 | Correct | 9 ms | 48720 KB | Output is correct |
9 | Correct | 8 ms | 48720 KB | Output is correct |
10 | Correct | 10 ms | 48740 KB | Output is correct |
11 | Correct | 9 ms | 48892 KB | Output is correct |
12 | Correct | 9 ms | 48720 KB | Output is correct |
13 | Correct | 9 ms | 48720 KB | Output is correct |
14 | Correct | 10 ms | 48732 KB | Output is correct |
15 | Correct | 13 ms | 48720 KB | Output is correct |
16 | Correct | 13 ms | 48720 KB | Output is correct |
17 | Correct | 11 ms | 48720 KB | Output is correct |
18 | Correct | 12 ms | 48932 KB | Output is correct |
19 | Correct | 11 ms | 48720 KB | Output is correct |
20 | Correct | 10 ms | 48720 KB | Output is correct |
21 | Correct | 10 ms | 48736 KB | Output is correct |
22 | Correct | 12 ms | 48976 KB | Output is correct |
23 | Correct | 37 ms | 54744 KB | Output is correct |
24 | Correct | 45 ms | 54868 KB | Output is correct |
25 | Correct | 303 ms | 92136 KB | Output is correct |
26 | Correct | 298 ms | 92080 KB | Output is correct |
27 | Correct | 297 ms | 91948 KB | Output is correct |
28 | Correct | 296 ms | 92080 KB | Output is correct |
29 | Correct | 195 ms | 63312 KB | Output is correct |
30 | Correct | 207 ms | 60744 KB | Output is correct |
31 | Correct | 246 ms | 66532 KB | Output is correct |
32 | Correct | 166 ms | 63424 KB | Output is correct |
33 | Correct | 165 ms | 60772 KB | Output is correct |
34 | Correct | 184 ms | 64180 KB | Output is correct |
35 | Correct | 227 ms | 66508 KB | Output is correct |
36 | Correct | 185 ms | 64332 KB | Output is correct |
37 | Correct | 206 ms | 64212 KB | Output is correct |
38 | Correct | 149 ms | 66528 KB | Output is correct |