제출 #632244

#제출 시각아이디문제언어결과실행 시간메모리
632244deviceDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back typedef long long ll; using namespace std; int main(){ int n, l, u; cin >> n >> l >> u; vector<pair<int,int>> v(n); for(int i = 0; i < n; i++){ cin >> v[i].ff; v[i].ss = i; } sort(v.begin(), v.end()); int cur = v[0].ff; int ptr = 0; if(cur >= l && cur <= u){ cout << 1 << endl << v[0].ss << endl; return 0; } for(int i = 1; i < n; i++){ cur += v[i].ff; if(cur >= l && cur <= u){ cout << i-ptr+1 << endl; for(int j = ptr; j <= i; j++){ cout << v[j].ss << " "; } return 0; } while(cur > u && ptr <= i){ cur -= v[ptr].ff; ptr++; } if(cur >= l && cur <= u){ cout << i-ptr+1 << endl; for(int j = ptr; j <= i; j++){ cout << v[j].ss << " "; } return 0; } } cout << 0 << endl; return 0; }

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

cc1plus: error: '::main' must return 'int'