| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1027548 | Issa | Fire (BOI24_fire) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"
const int maxn = 3e5 + 100;
const ll INF = (ll)1e18 + 100;
const int inf = 1e9 + 100;
const int MOD = 1e9 + 7;
const int maxl = 350;
const int P = 31;
int n, m;
pii a[maxn];
void test(){
cin >> n >> m;
for(int i = 0; i < n; i++){
cin >> a[i].first >> a[i].second;
}
vector<pii> v; int ans = inf;
for(int i = 1; i < (1<<n); i++){
v.clear();
for(int j = 0; j < n; j++){
if(i & (1<<j)){
v.push_back({a[j].first, 1});
v.push_back({a[j].second, -1});
if(a[j].first > a[j].second) v.push_back({1, 1});
}
}
bool ok = 1;
sort(v.begin(), v.end());
for(int i = 0; i < v.size(); i++){
if(i) v[i].second += v[i-1].second;
if((i == v.size() - 1 || v[i+1].first > v[i].first) && !v[i].second){
ok = 0; break;
}
}
if(ok){
ans = min(ans, __builtin_popcount(i));
}
}
if(ans == inf) ans = -1;
cout << ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; t = 1;
while(t--) test();
cout << ent;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
