이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "islands.h"
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#ifdef DEBUG
auto& operator<<(auto& os, pair<auto, auto> &p) {
return os<<"("<<p.first<<", "<<p.second<<")";
}
auto& operator<<(auto& os, const auto &v) {
os<<"{";
for(auto it=begin(v);it!=end(v);++it) {
if(it != begin(v)) os<<", ";
os<<(*it);
}
return os<<"}";
}
void dbg_out(auto... x) {
((cerr<<' '<<x), ...) << endl;
}
#define dbg(x...) cerr<<"("<<#x<<"):", dbg_out(x);
#else
#define dbg(...)
#endif
variant<bool, vi> find_journey(int N, int M, vi U, vi V) {
if (N == 2) {
vi canoe_0, canoe_1;
rep(i,0,M) {
if(U[i] == 0) canoe_0.push_back(i);
else canoe_1.push_back(i);
}
bool possible = sz(canoe_0) >= 2 && sz(canoe_1) >= 1;
if(!possible) return false;
vi trip;
trip.push_back(canoe_0[0]);
trip.push_back(canoe_1[0]);
trip.push_back(canoe_0[1]);
trip.push_back(canoe_0[0]);
trip.push_back(canoe_1[0]);
trip.push_back(canoe_0[1]);
return trip;
}
int c01, c10, c02, c20;
c01 = c10 = c02 = c20 = -1;
rep(i,0,M) {
if(U[i] == 0 && V[i] == 1) c01 = i;
else if(U[i] == 1 && V[i] == 0) c10 = i;
else if(U[i] == 0 && V[i] == 2) c02 = i;
else if(U[i] == 2 && V[i] == 0) c20 = i;
}
vi trip = {
c01, c10,
c02, c20,
c10, c01,
c20, c02
};
return trip;
}
# | 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... |