Submission #1310462

#TimeUsernameProblemLanguageResultExecution timeMemory
1310462hyyhCloud Computing (CEOI18_clo)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <cstring>
#include <iomanip>
#include <set>
#include <bitset>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using piii = tuple<int,int,int>;
using pibii = tuple<int,bool,int,int>;
#define endl '\n'
#define f first
#define s second

#define int long long;

int const N = 100010;

int dp[N];

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    memset(dp,-1,sizeof dp);
    int n;cin >> n;
    vector<pibii> vc;
    for(int i = 0;i < n;i++){
        int a,b,c;cin >> a >> b >> c;
        vc.emplace_back(b,false,-a,-c);
    }
    int m;cin >> m;
    for(int j = 0;j < m;j++){
        int a,b,c;cin >> a >> b >> c;
        vc.emplace_back(b,true,a,c);
    }
    sort(vc.begin(),vc.end());
    int sum = 0;
    dp[0] = 0;
    // for(auto [a,b,c,d]:vc){
    //     cout << a << " " << b << " " << c << " " << d << endl;
    // }
    for(auto [a,b,c,d]:vc){
        //cout << a << " " << b << " " << c << " " << d << endl;
        if(c > 0){
            for(int i = sum;i >= 0;i--){
                if(dp[i] != -1) dp[max(0,i+c)] = max(dp[max(0,i+c)],dp[i]+d);
            }
        }
        else{
            for(int i = 0;i <= sum;i++){
                if(dp[i] != -1) dp[max(0,i+c)] = max(dp[max(0,i+c)],dp[i]+d);
            }
        }
        // for(int i = 0;i <= sum+max(0,c);i++) cout << dp[i] << " ";
        // cout << endl;
        sum += max(0,c);
    }
    cout << dp[0];
}

Compilation message (stderr)

clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:24:1: note: in expansion of macro 'int'
   24 | int const N = 100010;
      | ^~~
clo.cpp:24:11: error: 'N' does not name a type
   24 | int const N = 100010;
      |           ^
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:26:1: note: in expansion of macro 'int'
   26 | int dp[N];
      | ^~~
clo.cpp:26:5: error: 'dp' does not name a type
   26 | int dp[N];
      |     ^~
clo.cpp: In function 'int main()':
clo.cpp:30:12: error: 'dp' was not declared in this scope
   30 |     memset(dp,-1,sizeof dp);
      |            ^~
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:31:5: note: in expansion of macro 'int'
   31 |     int n;cin >> n;
      |     ^~~
clo.cpp:31:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   31 |     int n;cin >> n;
      |         ^
      |         yn
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:33:9: note: in expansion of macro 'int'
   33 |     for(int i = 0;i < n;i++){
      |         ^~~
clo.cpp:33:13: error: 'i' was not declared in this scope
   33 |     for(int i = 0;i < n;i++){
      |             ^
clo.cpp:33:24: error: expected ')' before ';' token
   33 |     for(int i = 0;i < n;i++){
      |        ~               ^
      |                        )
clo.cpp:33:25: error: 'i' was not declared in this scope
   33 |     for(int i = 0;i < n;i++){
      |                         ^
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:37:5: note: in expansion of macro 'int'
   37 |     int m;cin >> m;
      |     ^~~
clo.cpp:37:9: error: 'm' was not declared in this scope; did you mean 'tm'?
   37 |     int m;cin >> m;
      |         ^
      |         tm
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:38:9: note: in expansion of macro 'int'
   38 |     for(int j = 0;j < m;j++){
      |         ^~~
clo.cpp:38:13: error: 'j' was not declared in this scope; did you mean 'jn'?
   38 |     for(int j = 0;j < m;j++){
      |             ^
      |             jn
clo.cpp:38:24: error: expected ')' before ';' token
   38 |     for(int j = 0;j < m;j++){
      |        ~               ^
      |                        )
clo.cpp:38:25: error: 'j' was not declared in this scope; did you mean 'jn'?
   38 |     for(int j = 0;j < m;j++){
      |                         ^
      |                         jn
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:43:5: note: in expansion of macro 'int'
   43 |     int sum = 0;
      |     ^~~
clo.cpp:43:9: error: 'sum' was not declared in this scope
   43 |     int sum = 0;
      |         ^~~
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:51:17: note: in expansion of macro 'int'
   51 |             for(int i = sum;i >= 0;i--){
      |                 ^~~
clo.cpp:51:35: error: expected ')' before ';' token
   51 |             for(int i = sum;i >= 0;i--){
      |                ~                  ^
      |                                   )
clo.cpp:22:18: error: declaration does not declare anything [-fpermissive]
   22 | #define int long long;
      |                  ^~~~
clo.cpp:56:17: note: in expansion of macro 'int'
   56 |             for(int i = 0;i <= sum;i++){
      |                 ^~~
clo.cpp:56:35: error: expected ')' before ';' token
   56 |             for(int i = 0;i <= sum;i++){
      |                ~                  ^
      |                                   )