답안 #1089855

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1089855 2024-09-17T10:07:24 Z Frostidian Detecting Molecules (IOI16_molecules) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

vector < int > find_subset ( int l, int r, vector < int > isi ){
    int sa = 0;
    
    vector < int > ans;

    for ( int i = 1; i <= isi.size(); i++ ){
        sa += isi[i - 1];
        if ( sa >= l && sa <= r ){
            for ( int j = 1; j <= i; j++ ){
                ans.push_back(isi[j]);
            }
        }
    }

    return ans;
}
/* 
signed main(){
    vector < int > isi {2, 2, 2, 2, 2};
    vector < int > ans = find_subset ( 4, 4, isi );
    for ( auto x : ans ) cout << x << endl;
}
*/

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:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for ( int i = 1; i <= isi.size(); i++ ){
      |                      ~~^~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccpYR3GD.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status