| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 20676 | Kwiyomi Express (#35) | Can polan into space? (OJUZ11_space) | C++98 | 173 ms | 24720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;
int main()
{
int n;
cin >> n;
vector<vector<long long> > cost(n+1, vector<long long>(2));
vector<vector<long long> > from(n, vector<long long>(2));
// 0 : me fly early, 1 : me fly late
cost[0][1] = 0;
cost[0][0] = -9999999999999999LL;
for (int i=0; i<n; i++) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
cost[i+1][0] = max(cost[i][0] + b, cost[i][1] + a);
cost[i+1][1] = max(cost[i][0] + c, cost[i][1] + b);
from[i][0] = (cost[i+1][0] == cost[i][1] + a);
from[i][1] = (cost[i+1][1] == cost[i][1] + b);
}
printf("%lld\n", cost[n][0]);
vector<int> res(n);
int idx = 1;
int ll = 0, rr = 0;
res[n-1] = 0;
for (int i=n-1; i>=1; i--) {
if (from[i][idx] == 1) {
ll --;
res[i-1] = ll;
idx = 1;
} else {
rr ++;
res[i-1] = rr;
idx = 0;
}
}
for (int i=0; i<n; i++)
printf("%d ", res[i]-ll+1);
printf("\n");
}
컴파일 시 표준 에러 (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... | ||||
