답안 #972722

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972722 2024-05-01T04:37:25 Z vjudge1 Detecting Molecules (IOI16_molecules) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> 
#include <sstream> 
#include "molecules.h"
using namespace std; 
#define accepted ios_base::sync_with_stdio(false);cin.tie(nullptr); 
#define Daulbekov signed     
#define Makan main 
#define int long long 
#define double long double 
#define pb push_back 
#define pf push_front 
#define F first 
#define S second 
const int N=2e5+7; 
const int MAX=9e18+7; 
const int INF=1e18;
vector<int>find_subset(int l,int u,vector<int>w){
	pair<int,int>w1[w.size()+1];
	for(int i=0;i<w.size()*1LL;i++){
		w1[i].F=w[i];
		w1[i].S=i;
	}
	sort(w1,w1+w.size());
	int l1=0,r1=0,sum=w1[0].F;
	vector<int>ans;
	while(l1<w.size()*1LL&&r1<w.size()*1LL){
		if(l<=sum&&sum<=u){
			for(int i=l1;i<=r1;i++)ans.pb(w1[i].S);
			break;
		}
		else if(l>sum){
			r1++;
			sum+=w1[r1].F;
		}
		else if(sum>u){
			sum-=w1[l1].F;
			l++;
		}
	}
	return ans;
}
//Daulbekov Makan(){
//	accepted;
//	
//} 
// 2 2 4
// 2 2 2
// 3 2 1 3 2 1 3 3
// 3 2 1 3 2 1 

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:19:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   19 |  for(int i=0;i<w.size()*1LL;i++){
      |              ~^~~~~~~~~~~~~
molecules.cpp:26:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   26 |  while(l1<w.size()*1LL&&r1<w.size()*1LL){
      |        ~~^~~~~~~~~~~~~
molecules.cpp:26:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   26 |  while(l1<w.size()*1LL&&r1<w.size()*1LL){
      |                         ~~^~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccfB5gsk.o: in function `main':
grader.cpp:(.text.startup+0x13d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status