Submission #1104166

#TimeUsernameProblemLanguageResultExecution timeMemory
11041668pete8Topical (NOI23_topical)C++17
100 / 100
406 ms160280 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<cassert> #include<unordered_map> #include <queue> #include <cstdint> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include <iomanip> #include<numeric> #include<bitset> using namespace std; #define ll long long #define f first #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define vi vector<int> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-lopps") #define int long long using namespace std; const int mod=998244353,mxn=2e5+5,inf=1e18,minf=-1e18,lg=30; //#undef int int n,k,m,q; void setIO(string name){ ios_base::sync_with_stdio(0); cin.tie(0); freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } int32_t main(){ fastio cin>>n>>k; vector<vector<int>>req(n,vector<int>(k)); vector<vector<int>>add(n,vector<int>(k)); for(int i=0;i<n;i++)for(int j=0;j<k;j++)cin>>req[i][j]; for(int i=0;i<n;i++)for(int j=0;j<k;j++)cin>>add[i][j]; vector<vector<pii>>ord(k); vector<int>cur(k,0),point(k,0),cnt(n,0); for(int j=0;j<k;j++){ for(int i=0;i<n;i++)ord[j].pb({req[i][j],i}); sort(all(ord[j])); } vector<int>can,used(n,0); int ans=0,loop=0; for(int i=0;i<n;i++){ for(int j=0;j<k;j++){ while(point[j]<n&&cur[j]>=ord[j][point[j]].f){ loop++; cnt[ord[j][point[j]].s]++; if(cnt[ord[j][point[j]].s]==k)can.pb(ord[j][point[j]].s); point[j]++; } } while(!can.empty()){ ans++; for(int j=0;j<k;j++)cur[j]+=add[can.back()][j]; can.pop_back(); } } cout<<ans; }

Compilation message (stderr)

Main.cpp:32:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   32 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
Main.cpp:38:23: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   38 | void setIO(string name){
      |                       ^
Main.cpp:43:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   43 | int32_t main(){
      |              ^
Main.cpp: In function 'void setIO(std::string)':
Main.cpp:40:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:41:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...