제출 #1262320

#제출 시각아이디문제언어결과실행 시간메모리
1262320scalifrastico_098Detecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w){ long long k=0, f=0; int n=w.size(); vector<int> o, a; bool sp=true; for(int i=0; i<n; i++){if(w[i]!=w[0])sp=false;} if(!sp) { vector<pair<int, int>> a(n+1); vector<int> g; int y=0, l1=0, f1=0, ij=0; bool t=false; for(int i=0; i<n; i++){a[i].first=w[i]; a[i].second=i;} sort(a.begin(), a.end()); while(ij<n) { y+=a[ij].first; ij++; if(y>u){y-=a[l1].first; l1++;} if(y>=l&&y<=u){t=true; f1=i; break;} } if(t)for(int i=0; i<f; i++)g.push_back(a[i].second); return g; } else { for(long long i=1; i<=n; i++) { if(w[0]*i>=l&&w[0]*i<=u){f=i; break;} } for(long long i=0; i<f; i++)o.push_back(i); return o; } }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:13:92: error: 'i' was not declared in this scope
   13 |             y+=a[ij].first; ij++; if(y>u){y-=a[l1].first; l1++;} if(y>=l&&y<=u){t=true; f1=i; break;}
      |                                                                                            ^
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
      |         ^~~~