#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define int long long
#define ll long long
#define ff first
#define ss second
#define pint pair < int , int >
#define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL)
const int inf = 1e9 + 9;
const int mxn = 2e5 + 2;
const int mod = 1e9 + 7;
vector < vector < int > > u , r;
int n , k;
bool cmp(vector < int > a , vector < int > b) {
for (int i = 0; i < k; i++) {
if (a[i] < b[i]) return 1;
else if (a[i] > b[i]) return 0;
}
return 0;
}
signed main() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
vector < int > tv;
for (int j = 0; j < k; j++) {
int t;
cin >> t;
tv.push_back(t);
}
tv.push_back(i);
r.push_back(tv);
}
u.resize(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
int t;
cin >> t;
u[i].push_back(t);
}
}
sort(r.begin() , r.end() , cmp);
vector < int > p(k , 0);
int ans = 0;
for (int i = 0; i < n; i++) {
if (!cmp(p , r[i])) {
ans++;
for (int j = 0; j < k; j++) {
p[j] += u[r[i][k]][j];
}
}
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
780 KB |
Output is correct |
4 |
Correct |
404 ms |
45908 KB |
Output is correct |
5 |
Correct |
384 ms |
46372 KB |
Output is correct |
6 |
Correct |
391 ms |
46000 KB |
Output is correct |
7 |
Correct |
262 ms |
42856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Incorrect |
6 ms |
704 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
13 ms |
1524 KB |
Output is correct |
4 |
Correct |
141 ms |
12868 KB |
Output is correct |
5 |
Correct |
140 ms |
12148 KB |
Output is correct |
6 |
Execution timed out |
1020 ms |
118780 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
780 KB |
Output is correct |
4 |
Correct |
404 ms |
45908 KB |
Output is correct |
5 |
Correct |
384 ms |
46372 KB |
Output is correct |
6 |
Correct |
391 ms |
46000 KB |
Output is correct |
7 |
Correct |
262 ms |
42856 KB |
Output is correct |
8 |
Correct |
0 ms |
344 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 |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Incorrect |
6 ms |
704 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |