Submission #455100

#TimeUsernameProblemLanguageResultExecution timeMemory
455100Nima_NaderiCloud Computing (CEOI18_clo)C++14
72 / 100
875 ms1996 KiB
//In the name of God #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll MXN = 4e3 + 10; const ll MXM = 2e5 + 10; ll n, m; bool Tp[MXN]; ll M[MXN], F[MXN], T[MXN], Ind[MXN], dp[MXM]; void ckmx(ll &x, ll y){ x = max(x, y); } int main(){ ios::sync_with_stdio(0);cin.tie(0); cout.tie(0); cin >> n, iota(Ind + 1, Ind + MXN, 1); for(int i = 1; i <= n; i ++) cin >> T[i] >> F[i] >> M[i]; cin >> m; for(int i = 1; i <= m; i ++) cin >> T[i + n] >> F[i + n] >> M[i + n], Tp[i + n] = 1; sort(Ind + 1, Ind + n + m + 1, [&](const int &i, const int &j){ return F[i] < F[j]; }); for(int ii = 1; ii <= n + m; ii ++){ int i = Ind[ii]; if(Tp[i]) for(int j = MXM - 1; j >= T[i]; -- j) ckmx(dp[j], dp[j - T[i]] + M[i]); else for(int j = 0; j < MXM - T[i]; j ++) ckmx(dp[j], dp[j + T[i]] - M[i]); } cout << dp[0] << '\n'; return 0; } //N.N

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:14:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   14 |  for(int i = 1; i <= n; i ++) cin >> T[i] >> F[i] >> M[i]; cin >> m;
      |  ^~~
clo.cpp:14:60: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   14 |  for(int i = 1; i <= n; i ++) cin >> T[i] >> F[i] >> M[i]; cin >> m;
      |                                                            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...