Submission #965772

#TimeUsernameProblemLanguageResultExecution timeMemory
965772Trisanu_DasTopical (NOI23_topical)C++17
100 / 100
550 ms124404 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){ 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:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%lld",&k);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:22:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |    scanf("%lld",&x);
      |    ~~~~~^~~~~~~~~~~
Main.cpp:28:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |    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...