Submission #246816

# Submission time Handle Problem Language Result Execution time Memory
246816 2020-07-10T11:33:29 Z LittleFlowers__ Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0);
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define gg exit(0);

vector<int> find_subset(int l,int r,vector<int> w){
    vector<ii> a;
    forinc(i,0,w.size()-1)
        a.pb({w[i],i});
    sort(all(a));
    vector<int> ans;
    deque<int> d;
    long long tot=0;
    forv(i,w){
        tot+=i.fi;
        d.push_back(i.se);
        while(tot>r){
            tot-=w[d.front()];
            d.pop_front();
        }
        if(tot>=l){
            while(d.size()){
                ans.push_back(d.back());
                d.pop_back();
            }
            break;
        }
    }
    return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:11:12: error: request for member 'first' in 'i', which is of non-class type 'long long int'
 #define fi first
            ^
molecules.cpp:29:16: note: in expansion of macro 'fi'
         tot+=i.fi;
                ^~
molecules.cpp:12:12: error: request for member 'second' in 'i', which is of non-class type 'long long int'
 #define se second
            ^
molecules.cpp:30:23: note: in expansion of macro 'se'
         d.push_back(i.se);
                       ^~