Submission #98395

#TimeUsernameProblemLanguageResultExecution timeMemory
983950_marchukHokej (COCI17_hokej)C++14
72 / 120
501 ms48372 KiB
///-------------------/// //#pragma GCC optimize("O3") #include <bits/stdc++.h> /// --Constants-- /// #define MOD 1000000009 #define INF 2000000000 #define INFLL 9000000000000000000ll /// -- -- /// #define x first #define y second #define pb push_back #define mp make_pair #define elif else if #define sz(a) ((long long)((a).size())) #define all(a) (a).begin() , (a).end() #define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define what(x) cout << #x << " is " << x << '\n' #define int long long #define left rudenkoandaleksistorenonelove #define right aleksistorenandrudenkoonelove using namespace std; typedef unsigned long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector< pair<int, int> > vpii; const int MAXN = 500200, MAXM = 200, MAXP=18; int m, n, p, d; ll ans; int dp[6][MAXN], k[6]; vector<vector<int>> vec; void solve() { int cur = 0; for(int i = 0; i<6; i++) for(int j = 0; j<m;) { while(vec[cur][1]==0) cur++; int dist = min(vec[cur][1], m-j); vec[cur][1]-=dist; dp[i][j]=vec[cur][2]; ans+=1ll*vec[cur][0]*dist; j+=dist; } cout << ans << '\n'; for(int i = 0; i<6; i++) { k[i]=dp[i][0]; cout << k[i] << ' '; } cout << '\n'; vec.clear(); for(int j = 1; j<m; j++ ) for(int i = 0; i<6; i++) { if(dp[i][j]) { vec.pb({j, k[i], dp[i][j]}); k[i]=dp[i][j]; } } cout << vec.size() << '\n'; // reverse(all(vec)); for(int i = 0; i<vec.size(); i++) { cout << vec[i][0] << ' ' << vec[i][1] << ' ' << vec[i][2] << '\n'; } } int32_t main() { fastio; cin >> m >> n; for(int i = 0; i<n; i++) { cin >> p >> d; vec.pb({p, d, i+1}); } sort(all(vec)); reverse(all(vec)); solve(); }

Compilation message (stderr)

hokej.cpp: In function 'void solve()':
hokej.cpp:75:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i<vec.size(); i++)
                    ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...