# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1038191 | hotboy2703 | Building 4 (JOI20_building4) | C++17 | 45 ms | 21852 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
const ll MAXN = 5e5+100;
ll A[MAXN][2];
bool ans[MAXN];
ll n;
int main(){
ios_base::sync_with_stdio(0);cin.tie(nullptr);
cin>>n;
n*=2;
for (ll i = 1;i <= n;i ++)cin>>A[i][0];
for (ll i = 1;i <= n;i ++)cin>>A[i][1];
ll last = -1;
for (ll i = 1;i <= n;i ++){
bool sw = 0;
if (A[i][0] > A[i][1]){
swap(A[i][0],A[i][1]);
sw = 1;
}
if (max(A[i][0],A[i][1]) < last){
cout<<-1<<endl;
return 0;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |