Submission #841675

#TimeUsernameProblemLanguageResultExecution timeMemory
841675kwongwengTopical (NOI23_topical)C++17
12 / 100
460 ms102072 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef pair<ll, ll> pll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define ms memset #define pb push_back #define fi first #define se second int main(){ int n, k; cin>>n>>k; ll r[n][k], u[n][k]; vector<pair<ll,int>> arr[k]; FOR(i,0,n){ FOR(j,0,k) cin>>r[i][j]; } FOR(j,0,k){ FOR(i,0,n) arr[j].pb({r[i][j], i}); sort(arr[j].begin(), arr[j].end()); } FOR(i,0,n){ FOR(j,0,k) cin>>u[i][j]; } int mat[n][k]; ms(mat,0,sizeof(mat)); vi cnt(k); vi bfs; vector<ll> p(k); vi cur(k); FOR(j,0,k){ while (cur[j] < n && p[j] >= arr[j][cur[j]].fi){ int pos = arr[j][cur[j]].se; cnt[pos]++; if (cnt[pos]==k){ bfs.pb(pos); } cur[j]++; } } FOR(i,0,bfs.size()){ //cout<<bfs[i]<<"\n"; int ind = bfs[i]; FOR(j,0,k){ p[j] += u[ind][j]; while (cur[j] < n && p[j] >= arr[j][cur[j]].fi){ int pos = arr[j][cur[j]].se; cnt[pos]++; if (cnt[pos]==k){ bfs.pb(pos); } cur[j]++; } } } cout<<bfs.size()<<"\n"; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define FOR(i, a, b) for(int i = a; i < b; i++)
......
   45 |     FOR(i,0,bfs.size()){
      |         ~~~~~~~~~~~~~~                 
Main.cpp:45:5: note: in expansion of macro 'FOR'
   45 |     FOR(i,0,bfs.size()){
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...