제출 #973716

#제출 시각아이디문제언어결과실행 시간메모리
973716NemanjaSo2005Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>#include "molecules.h"#define ll long longusing namespace std;ll N,zbir;struct slog{ int org,vred;}sniz[5000005];bool cmp(slog a,slog b){ return a.vred<b.vred;}vector<int> find_subset(int L, int R, vector<int> niz){ N=niz.size(); for(int i=1;i<=N;i++){ sniz[i].org=i-1; sniz[i].vred=niz[i-1]; } //sort(sniz+1,sniz+1+N,cmp); int i=1,j=1; zbir=sniz[1].vred; while(j<=N){ if(i>j) break; if(zbir<L){ j++; zbir+=sniz[j].vred; } else if(zbir>R){ zbir-=sniz[i].vred; i++; } if(zbir<=R and zbir>=L){ niz.clear(); for(int k=i;k<=j;k++) niz.push_back(sniz[k].org); return niz; } } niz.clear(); return niz;}

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

molecules.cpp:1:24: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h>#include "molecules.h"#define ll long longusing namespace std;ll N,zbir;struct slog{  int org,vred;}sniz[5000005];bool cmp(slog a,slog b){  return a.vred<b.vred;}vector<int> find_subset(int L, int R, vector<int> niz){    N=niz.size();    for(int i=1;i<=N;i++){      sniz[i].org=i-1;      sniz[i].vred=niz[i-1];    }    //sort(sniz+1,sniz+1+N,cmp);    int i=1,j=1;    zbir=sniz[1].vred;    while(j<=N){      if(i>j)         break;      if(zbir<L){        j++;        zbir+=sniz[j].vred;      }      else if(zbir>R){        zbir-=sniz[i].vred;        i++;      }      if(zbir<=R and zbir>=L){         niz.clear();         for(int k=i;k<=j;k++)            niz.push_back(sniz[k].org);         return niz;      }    }    niz.clear();    return niz;}
      |                        ^
/usr/bin/ld: /tmp/ccVdMzHj.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