제출 #1021226

#제출 시각아이디문제언어결과실행 시간메모리
1021226vjudge1Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
// #pragma once #include <bits/stdc++.h> using namespace std; typedef long long ll; int n; ll a[200100]; ll sum(int l, int r){ return a[r] - a[l-1]; } std::vector<int> find_subset(ll L, ll R, std::vector<int> w){ n = w.size(); for(int i = 0; i < n; i++){ a[i+1] = w[i]; } sort(a + 1, a + n + 1); for(int i = 1; i <= n; i++){ a[i] += a[i-1]; } for(int k = 1; k <= n; k++){ if(max(L, sum(1, k)) <= min(R, sum(n - k + 1, n))){ int i = 1; while(sum(i, i + k - 1) < L || sum(i, i + k - 1) > R){ i++; } multiset<int> s; for(int j = i; j < i + k; j++){ s.insert(a[j] - a[j-1]); } vector<int> res; for(int i = 0; i < n; i++){ if(s.count(w[i])){ s.erase(s.find(w[i])); res.push_back(i); } } return res; } } return {}; }

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

/usr/bin/ld: /tmp/ccJ1AWYx.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