제출 #589433

#제출 시각아이디문제언어결과실행 시간메모리
589433KrisjanisPDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
 
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    ll curW = 0, curI=0;
    while(curI<w.size()&&curW<l)
        curW += w[curI++];
    if(curW<l||curW>r) return {};
    vector<int> res;
    for(ll i=0;i<curI;i++)
        res.push_back(i);
    return res;
}

컴파일 시 표준 에러 (stderr) 메시지

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:15: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     while(curI<w.size()&&curW<l)
      |           ~~~~^~~~~~~~~
molecules.cpp:11:21: error: 'r' was not declared in this scope
   11 |     if(curW<l||curW>r) return {};
      |                     ^