이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <variant>
#include <vector>
using namespace std;
std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> v1, std::vector<int> v2)
{
if(2<N)
return true;
// if (N == 4) {
// return std::vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3});
// }
// return false;
int n=N,m=M;
map<pair<int,int>,vector<int>> cnt;
for(int j=0;j<m;j++)
cnt[{v1[j],v2[j]}].push_back(j);
if(cnt[{0,1}].size()>=2 and cnt[{1,0}].size()>=1)
{
int f=cnt[{0,1}][0];
int s=cnt[{0,1}][1];
int th=cnt[{1,0}][0];
return vector<int>({f,th,s,f,th,s});
}
else
{
return false;
}
}
컴파일 시 표준 에러 (stderr) 메시지
islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:14:9: warning: unused variable 'n' [-Wunused-variable]
14 | int n=N,m=M;
| ^
# | 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... |