Submission #165393

#TimeUsernameProblemLanguageResultExecution timeMemory
165393theStaticMindHokej (COCI17_hokej)C++14
72 / 120
287 ms44824 KiB
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; struct Player{ int Q,I,id; bool operator<(Player& A){ return Q<A.Q; } Player(int a=0,int b=0,int c=0){ Q=a,I=b,id=c; } }; vector<Player> arr(1); vector<int> A; bool cmp(int a,int b){ return arr[a].Q<arr[b].Q; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int m,n; cin>>m>>n; for(int i=0;i<n;i++){ int a,b; cin>>a>>b; arr.pb(Player(a,b,i+1)); A.pb(i+1); } sort(all(A),cmp); reverse(all(A)); vector<int> matrix[6]; int ind=0,cnt=0; for(int i=0;i<6;i++){ matrix[i].resize(m); for(int j=0;j<m;j++){ arr[A[ind]].I--; matrix[i][j]=A[ind]; if(arr[A[ind]].I==0)ind++; } } for(int i=0;i<6;i++){ for(int j=0;j<m;j++)cnt+=arr[matrix[i][j]].Q; } cout<<cnt<<"\n"; for(int i=0;i<6;i++)cout<<matrix[i][0]<<" "; cout<<"\n"; vector<pair<int,ii> >ans; for(int i=1;i<m;i++){ for(int j=0;j<6;j++){ if(matrix[j][i]!=matrix[j][i-1])ans.pb({i,{matrix[j][i-1],matrix[j][i]}}); } } cout<<ans.size()<<"\n"; for(int i=0;i<ans.size();i++)cout<<ans[i].first<<" "<<ans[i].second.first<<" "<<ans[i].second.second<<"\n"; }

Compilation message (stderr)

hokej.cpp: In function 'int32_t main()':
hokej.cpp:63:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int i=0;i<ans.size();i++)cout<<ans[i].first<<" "<<ans[i].second.first<<" "<<ans[i].second.second<<"\n";
                   ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...