제출 #1326534

#제출 시각아이디문제언어결과실행 시간메모리
1326534rainerevan_Detecting Molecules (IOI16_molecules)C++20
100 / 100
35 ms6156 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") typedef long long ll; const ll INF = 1e18; const ll MOD = 1e9 + 7; const ll MAXN = 1e6 + 5; const ll LOG = 30; #define vll vector <ll> #define vi vector <int> #define pll pair <ll, ll> #define fi first #define se second #define endl '\n' #define debug(x) cout << #x << " " << (x) << endl; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vi z; vector <pll> v; ll sz = w.size(); for(ll i = 0; i < sz; i++){ if(w[i] >= l){ if(w[i] <= u) return vi (1, i); } else v.push_back({w[i], i}); } sort(v.begin(), v.end()); sz = v.size(); ll tot = 0; for(ll i = 0; i < sz; i++){ tot += v[i].fi; if(tot >= l){ if(tot <= u){ for(ll j = 0; j <= i; j++) z.push_back(v[j].se); sort(z.begin(), z.end()); return z; } // dari 0 sampe i-1 tot -= v[i].fi; for(ll j = 0; j < i; j++){ if(tot-v[j].fi+v[sz-1-j].fi >= l){ for(ll k = j+1; k < i; k++) z.push_back(v[k].se); for(ll k = sz-1-j; k < sz; k++) z.push_back(v[k].se); sort(z.begin(), z.end()); return z; } tot += -v[j].fi+v[sz-1-j].fi; } return std::vector<int>(0); } } return std::vector<int>(0); } // 10 11 // 4 4 4 5 5

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

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
      |         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...