제출 #1263639

#제출 시각아이디문제언어결과실행 시간메모리
1263639piolkDetecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll=long long; vector<int> find_subset(int l,int r,vector<ll> w){ unordered_map<int,vector<int>> wyst; // value,index for (int i=0;i<w.size();i++) wyst[w[i]].push_back(i); sort(w.begin(),w.end()); int n=w.size(); int R=-1; int L=0; ll sum=0; while (R<n-1){ R++; sum+=w[R]; while (sum>r && L<R){ sum-=w[L]; L++; } if (sum>=l && sum<=r){ vector<int> indices; for (int i=L;i<=R;i++){ int index=wyst[w[i]].back(); wyst[w[i]].pop_back(); indices.push_back(index); } return indices; } } return {}; }

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

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/ccJQklec.o: in function `main':
grader.cpp:(.text.startup+0x173): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status