답안 #129794

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129794 2019-07-13T08:53:47 Z miguel Detecting Molecules (IOI16_molecules) C++14
컴파일 오류
0 ms 0 KB
#include <molecules.h>
#include<bits/stdc++.h>

using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define int ll
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 1e9 + 7;
 
vi find_subset(int l, int u, vi w){
    vector<pi> v;
    v.pb({0, 0});
    int n=w.size();
    for(int i=0; i<w.size(); i++) v.pb({w[i], i+1});
    sort(v.begin(), v.end());
 
    ll s[200002];
    s[0]=0;
    for(int i=1; i<=n; i++) s[i]=s[i-1]+v[i].x;
 
    int k=0;
    while(s[k+1]-s[1]<l && s[n]-s[n-k]<l){k++;}
    //if(k==0) return {};
    for(int i=1; i<=n-k+1; i++){
        if(s[i+k-1]-s[i-1]>=l && s[i+k-1]-s[i-1]<=u){
            vector <int> ans;
            for(int j=i; j<=i+k-1; j++) ans.pb(v[j].y);
            return ans;
        }
    }
    return {};
}

Compilation message

molecules.cpp:15:7: error: 'll' does not name a type
 const ll mod = 1e9 + 7;
       ^~
molecules.cpp:8:13: error: 'll' was not declared in this scope
 #define int ll
             ^
molecules.cpp:14:20: note: in expansion of macro 'int'
 #define vi vector <int>
                    ^~~
molecules.cpp:17:1: note: in expansion of macro 'vi'
 vi find_subset(int l, int u, vi w){
 ^~
molecules.cpp:14:23: error: template argument 1 is invalid
 #define vi vector <int>
                       ^
molecules.cpp:17:1: note: in expansion of macro 'vi'
 vi find_subset(int l, int u, vi w){
 ^~
molecules.cpp:14:23: error: template argument 2 is invalid
 #define vi vector <int>
                       ^
molecules.cpp:17:1: note: in expansion of macro 'vi'
 vi find_subset(int l, int u, vi w){
 ^~
molecules.cpp:8:13: error: 'int find_subset' redeclared as different kind of symbol
 #define int ll
             ^
molecules.cpp:17:16: note: in expansion of macro 'int'
 vi find_subset(int l, int u, vi w){
                ^~~
In file included from molecules.cpp:1:0:
molecules.h:5:18: note: previous declaration 'std::vector<int> find_subset(int, int, std::vector<int>)'
 std::vector<int> find_subset(int l, int u, std::vector<int> w);
                  ^~~~~~~~~~~
molecules.cpp:8:13: error: 'll' was not declared in this scope
 #define int ll
             ^
molecules.cpp:17:16: note: in expansion of macro 'int'
 vi find_subset(int l, int u, vi w){
                ^~~
molecules.cpp:8:13: error: 'll' was not declared in this scope
 #define int ll
             ^
molecules.cpp:17:23: note: in expansion of macro 'int'
 vi find_subset(int l, int u, vi w){
                       ^~~
molecules.cpp:8:13: error: 'll' was not declared in this scope
 #define int ll
             ^
molecules.cpp:14:20: note: in expansion of macro 'int'
 #define vi vector <int>
                    ^~~
molecules.cpp:17:30: note: in expansion of macro 'vi'
 vi find_subset(int l, int u, vi w){
                              ^~
molecules.cpp:14:23: error: template argument 1 is invalid
 #define vi vector <int>
                       ^
molecules.cpp:17:30: note: in expansion of macro 'vi'
 vi find_subset(int l, int u, vi w){
                              ^~
molecules.cpp:14:23: error: template argument 2 is invalid
 #define vi vector <int>
                       ^
molecules.cpp:17:30: note: in expansion of macro 'vi'
 vi find_subset(int l, int u, vi w){
                              ^~