제출 #1299582

#제출 시각아이디문제언어결과실행 시간메모리
1299582gesp3011v2Detecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;
#include "molecules.h"

vector<int> find_subset(int l,int u,vector<int> w){
    int n=w.size();
    int s=0;
    for(int i=0,j=0;j<n;j++){
        s+=w[r];
        while(s>u){
            s-=w[i];
            i++;
        }
        if(s<=u && s>=l){
            vector<int> ans;
            for(int k=i;k<=r;k++)ans.push_back(k);
            return ans;
        }
    }
    return {};
}

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:14: error: 'r' was not declared in this scope
    9 |         s+=w[r];
      |              ^
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
      |         ^~~~