| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 20484 | 볼빨간민돌이 (#35) | 초음속철도 (OJUZ11_rail) | C++11 | 449 ms | 1340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int MAXM = 20;
const int mod = 1e9+7;
int n, m, s[MAXM+1], e[MAXM+1];
bool use[MAXM+1];
int check(){
vector<pair<int,int>> v;
for(int i=1; i<=m; i++)
if(use[i]) v.push_back(make_pair(s[i], e[i]));
sort(v.begin(), v.end());
if(v.empty()) return 0;
int now=1;
for(auto &e:v){
if(e.first > now) break;
else now=max(now, e.second);
}
return now==n;
}
int f(int now){
if(now==m+1) return check();
int sum=0;
use[now]=true;
sum+=f(now+1);
use[now]=false;
sum+=f(now+1);
return sum;
}
int main(){
scanf("%d %d", &n, &m);
for(int i=1; i<=m; i++)
scanf("%d %d", &s[i], &e[i]);
printf("%d", f(1));
return 0;
}
컴파일 시 표준 에러 (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... | ||||
