제출 #919639

#제출 시각아이디문제언어결과실행 시간메모리
919639NurislamDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back vector<int> find_subset(int l, int r, vector<int> temp) { vector<int> ans; int n=temp.size(); vector<pair<int, int>> w; for (int i = 0; i < n; ++i) { w.push_back({temp[i], i}); } sort(w.begin(), w.end()); long long sum=0; int i = 0, j = 0, sum = 0; while(j < n){ sum+=w[j++].first; while(sum > r){ sum -= w[i++].first; } if(sum > l){ for(; i <= j; i++){ ans.pb(w[i].second); }return ans; } } return ans; }

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

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:17:20: error: redeclaration of 'long long int sum'
   17 |  int i = 0, j = 0, sum = 0;
      |                    ^~~
molecules.cpp:16:12: note: 'long long int sum' previously declared here
   16 |  long long sum=0;
      |            ^~~