Submission #929227

#TimeUsernameProblemLanguageResultExecution timeMemory
929227Batorgil952Topical (NOI23_topical)C++14
100 / 100
549 ms111784 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second using namespace std; const int N=1e6+6; vector< pair< ll, ll > > v[N]; vector< ll > u[N]; ll a[N], p[N]; ll b[N]; int main(){ ll t, n, k, i, j, ind, rn, x, ans; scanf("%lld",&n); scanf("%lld",&k); for(i=1; i<=n; i++){ for(j=1; j<=k; j++){ scanf("%lld",&x); v[j].pb(mp(x, i)); } } for(i=1; i<=n; i++){ for(j=1; j<=k; j++){ scanf("%lld",&x); u[i].pb(x); } } for(j=1; j<=k; j++){ sort(v[j].begin(), v[j].end()); } ans=0; ind=1; while(ans<n && ind==1){ ind=0; vector< ll > R; for(i=1; i<=k; i++){ while(v[i][p[i]].ff<=a[i] && p[i]<n){ b[v[i][p[i]].ss]++; if(b[v[i][p[i]].ss]==k){ R.pb(v[i][p[i]].ss); } p[i]++; } } rn=R.size(); if(rn>0){ ind++; ans+=rn; } for(i=0; i<rn; i++){ for(j=0; j<k; j++){ a[j+1]+=u[R[i]][j]; } } } printf("%lld\n", ans); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:17:5: warning: unused variable 't' [-Wunused-variable]
   17 |  ll t, n, k, i, j, ind, rn, x, ans;
      |     ^
Main.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%lld",&k);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |    scanf("%lld",&x);
      |    ~~~~~^~~~~~~~~~~
Main.cpp:30:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |    scanf("%lld",&x);
      |    ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...