제출 #1134829

#제출 시각아이디문제언어결과실행 시간메모리
1134829ackhavaDetecting Molecules (IOI16_molecules)C++20
100 / 100
48 ms6584 KiB
#include "molecules.h" #include <bits/stdc++.h> #define REP(v, i, j) for (int v = i; v != j; v++) #define FORI(v) for (auto i : v) #define FORJ(v) for (auto j : v) #define OUT(v, a) \ FORI(v) \ cout << i << a; #define OUTS(v, a, b) \ cout << v.size() << a; \ OUT(v, b) #define in(a, n) \ REP(i, 0, n) \ cin >> a[i]; #define SORT(v) sort(begin(v), end(v)) #define REV(v) reverse(begin(v), end(v)) #define MEMSET(m) memset(m, -1, sizeof m) #define pb push_back #define fi first #define se second #define detachIO \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); using namespace std; typedef pair<int, int> pii; typedef pair<pii, int> piii; typedef pair<pii, pii> piiii; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> ans; vector<pii> dj; REP(i,0,w.size())dj.pb({w[i],i}); SORT(dj); vector<long long> vec; long long cur=0; int s=0; SORT(w); REP(i,0,w.size()){ cur+=w[i]; vec.pb(cur); if(cur<=u)s=i+1; // cerr<<i<<" -> "<<cur<<'\n'; } // cerr<<"s = "<<s<<endl; if(s==0)return {}; cur=0; REP(i,0,s){ cur+=w[w.size()-1-i]; } if(cur<l)return {}; REP(i,0,w.size()){ if((i+s)>w.size())break; long long sum=vec[i+s-1]; if(i)sum-=vec[i-1]; // cerr<<i<<" - "<<(i+s)<<": "<<sum<<endl; if((long long)l<=sum && sum<=(long long)u){ REP(j,i,i+s){ ans.pb(dj[j].se); } return ans; } } return {}; }

컴파일 시 표준 에러 (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...