Submission #1149731

#TimeUsernameProblemLanguageResultExecution timeMemory
1149731SSSMCloud Computing (CEOI18_clo)C++20
Compilation error
0 ms0 KiB
#if defined(__GNUC__) #pragma GCC optimize ("Ofast") #endif using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<pii, int> piii; typedef pair<ll, ll> pll; #define debug(x) cerr<<#x<<'='<<(x)<<endl; #define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl; #define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl; #define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl; #define all(x) x.begin(), x.end() #define pb push_back #define kill(x) return cout<<x<<'\n', 0; const ld eps=1e-7; const int inf=1000000010; const ll INF=10000000000010000LL; const int mod = 1000000007; const int MAXN = 2010, LOG=20; struct SERVER{ ll c, f, v, typ; bool operator <(SERVER M){ if (f==M.f) return typ<M.typ; return f>M.f; } } A[MAXN*2]; ll n, m, k, u, v, x, y, t, c, f, ans; ll dp[2][MAXN*50]; inline void upd(ll &x, ll y){ x=max(x, y); } int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); cin>>n; for (int i=1; i<=n; i++){ cin>>c>>f>>v; A[i]={c, f, v, 0}; } cin>>m; for (int i=1; i<=m; i++){ cin>>c>>f>>v; A[i+n]={c, f, v, 1}; } sort(A+1, A+n+m+1); memset(dp, -63, sizeof(dp)); dp[0][0]=0; int prev=0, curr=1; for (int i=1; i<=n+m; i++){ for (int j=0; j<=n*50; j++){ dp[curr][j]=-INF; //upd(dp[curr][j], dp[curr][j+1]); // optional upd(dp[curr][j], dp[prev][j]); if (A[i].typ) upd(dp[curr][j], dp[prev][j+A[i].c] + A[i].v); else if (j>=A[i].c) upd(dp[curr][j], dp[prev][j-A[i].c] - A[i].v); } swap(prev, curr); } for (int i=0; i<=n*50; i++) ans=max(ans, dp[prev][i]); cout<<ans<<'\n'; return 0; }

Compilation message (stderr)

clo.cpp:7:9: error: 'pair' does not name a type
    7 | typedef pair<int, int> pii;
      |         ^~~~
clo.cpp:8:14: error: 'pii' was not declared in this scope
    8 | typedef pair<pii, int> piii;
      |              ^~~
clo.cpp:8:14: error: 'pii' was not declared in this scope
clo.cpp:8:14: error: 'pii' was not declared in this scope
clo.cpp:8:14: error: 'pii' was not declared in this scope
clo.cpp:8:14: error: 'pii' was not declared in this scope
clo.cpp:8:14: error: 'pii' was not declared in this scope
clo.cpp:8:9: error: 'pair' does not name a type
    8 | typedef pair<pii, int> piii;
      |         ^~~~
clo.cpp:9:9: error: 'pair' does not name a type
    9 | typedef pair<ll, ll> pll;
      |         ^~~~
clo.cpp: In function 'void upd(ll&, ll)':
clo.cpp:36:11: error: 'max' was not declared in this scope
   36 |         x=max(x, y);
      |           ^~~
clo.cpp: In function 'int main()':
clo.cpp:40:9: error: 'ios_base' has not been declared
   40 |         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |         ^~~~~~~~
clo.cpp:40:42: error: 'cin' was not declared in this scope
   40 |         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |                                          ^~~
clo.cpp:1:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
  +++ |+#include <iostream>
    1 | #if defined(__GNUC__)
clo.cpp:40:53: error: 'cout' was not declared in this scope
   40 |         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |                                                     ^~~~
clo.cpp:40:53: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
clo.cpp:54:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   54 |         sort(A+1, A+n+m+1);
      |         ^~~~
      |         short
clo.cpp:56:9: error: 'memset' was not declared in this scope
   56 |         memset(dp, -63, sizeof(dp));
      |         ^~~~~~
clo.cpp:1:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
  +++ |+#include <cstring>
    1 | #if defined(__GNUC__)
clo.cpp:67:17: error: 'swap' was not declared in this scope
   67 |                 swap(prev, curr);
      |                 ^~~~
clo.cpp:70:41: error: 'max' was not declared in this scope
   70 |         for (int i=0; i<=n*50; i++) ans=max(ans, dp[prev][i]);
      |                                         ^~~