Submission #931811

#TimeUsernameProblemLanguageResultExecution timeMemory
931811SyriusTopical (NOI23_topical)C++14
12 / 100
1074 ms125068 KiB
#include <bits/stdc++.h> 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]; } } else break; } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...