Submission #49164905
Source Code Expand
// LUOGU_RID: 142306371
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
#define rep(i,l,r) for(int i(l);i<=(r);++i)
#define per(i,r,l) for(int i(r);i>=(l);--i)
#define eb emplace_back
#define File(filename) freopen(filename ".in","r",stdin),freopen(filename ".out","w",stdout)
#ifdef EXODUS
#define Debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define Debug(...) 0
#endif
//=========================================================================================================
// Something about IO
template<typename T>
void read(T &x){
x=0;T flg=1;
char ch=getchar();
while(!isdigit(ch)){if(ch=='-')flg=-1;ch=getchar();}
while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
x*=flg;
}
template<typename T,typename... Args>
void read(T &x,Args &...args){read(x),read(args...);}
//=========================================================================================================
// Define the global variables here.
bool membg=0;
bool memed=0;
//=========================================================================================================
// Code here.
void solve(){
int n;
read(n);
vector<int>a(n),b(n);
for(auto &x:a)read(x);
for(auto &x:b)read(x);
auto trans=[&](vector<int>&arr){
bool flg=false;
int len=arr.size();
for(int i=0;i+2<len;i++)if(arr[i]%2+arr[i+1]%2+arr[i+2]%2==2){flg=true;break;}
if(!flg){
for(int i=0,j=0;i<len;i=j+1,j=i){
// printf("%d %d\n",i,j);
while(j<len&&((arr[j]&1)^1))j++;
if(j-i>=3)sort(arr.begin()+i,arr.begin()+j);
}
}else{
vector<int>lis[2];
for(auto x:arr)lis[x&1].eb(x);
arr.clear();
if(lis[0].size()>=3)sort(lis[0].begin(),lis[0].end());
sort(lis[1].begin(),lis[1].end());
arr.insert(arr.end(),lis[0].begin(),lis[0].end());
arr.insert(arr.end(),lis[1].begin(),lis[1].end());
}
};
trans(a),trans(b);
puts(a==b?"Yes":"No");
return;
}
//=========================================================================================================
int main(){
Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
int timbg=clock();
int T=1;
while(T--)solve();
int timed=clock();
Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
fflush(stdout);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Even Sum Triplet |
| User | EXODUS |
| Language | C++ 20 (gcc 12.2) |
| Score | 700 |
| Code Size | 2386 Byte |
| Status | AC |
| Exec Time | 36 ms |
| Memory | 6456 KiB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:18:28: warning: statement has no effect [-Wunused-value]
18 | #define Debug(...) 0
| ^
Main.cpp:80:9: note: in expansion of macro ‘Debug’
80 | Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
| ^~~~~
Main.cpp:18:28: warning: statement has no effect [-Wunused-value]
18 | #define Debug(...) 0
| ^
Main.cpp:85:9: note: in expansion of macro ‘Debug’
85 | Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
| ^~~~~
Main.cpp:81:13: warning: unused variable ‘timbg’ [-Wunused-variable]
81 | int timbg=clock();
| ^~~~~
Main.cpp:84:13: warning: unused variable ‘timed’ [-Wunused-variable]
84 | int timed=clock();
| ^~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 700 / 700 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 01_rand_10.txt, 01_rand_11.txt, 01_rand_12.txt, 01_rand_13.txt, 01_rand_14.txt, 01_rand_15.txt, 01_rand_16.txt, 02_max_rand_01.txt, 02_max_rand_02.txt, 02_max_rand_03.txt, 02_max_rand_04.txt, 02_max_rand_05.txt, 02_max_rand_06.txt, 02_max_rand_07.txt, 02_max_rand_08.txt, 03_two_even_01.txt, 03_two_even_02.txt, 03_two_even_03.txt, 03_two_even_04.txt, 03_two_even_05.txt, 03_two_even_06.txt, 03_two_even_07.txt, 03_two_even_08.txt, 03_two_even_09.txt, 03_two_even_10.txt, 03_two_even_11.txt, 03_two_even_12.txt, 03_two_even_13.txt, 03_two_even_14.txt, 03_two_even_15.txt, 03_two_even_16.txt, 04_other_01.txt, 04_other_02.txt, 04_other_03.txt, 04_other_04.txt, 04_other_05.txt, 04_other_06.txt, 04_other_07.txt, 04_other_08.txt, 04_other_09.txt, 04_other_10.txt, 04_other_11.txt, 04_other_12.txt, 04_other_13.txt, 04_other_14.txt, 04_other_15.txt, 04_other_16.txt, 05_test_01.txt, 05_test_02.txt, 05_test_03.txt, 05_test_04.txt, 05_test_05.txt, 05_test_06.txt, 05_test_07.txt, 05_test_08.txt, 05_test_09.txt, 05_test_10.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 3 ms | 3704 KiB |
| 00_sample_02.txt | AC | 1 ms | 3392 KiB |
| 00_sample_03.txt | AC | 1 ms | 3504 KiB |
| 01_rand_01.txt | AC | 25 ms | 5660 KiB |
| 01_rand_02.txt | AC | 32 ms | 5872 KiB |
| 01_rand_03.txt | AC | 22 ms | 5232 KiB |
| 01_rand_04.txt | AC | 29 ms | 5736 KiB |
| 01_rand_05.txt | AC | 6 ms | 5092 KiB |
| 01_rand_06.txt | AC | 9 ms | 5796 KiB |
| 01_rand_07.txt | AC | 13 ms | 5400 KiB |
| 01_rand_08.txt | AC | 10 ms | 4844 KiB |
| 01_rand_09.txt | AC | 11 ms | 4680 KiB |
| 01_rand_10.txt | AC | 7 ms | 4216 KiB |
| 01_rand_11.txt | AC | 9 ms | 4172 KiB |
| 01_rand_12.txt | AC | 11 ms | 4212 KiB |
| 01_rand_13.txt | AC | 5 ms | 4168 KiB |
| 01_rand_14.txt | AC | 3 ms | 4164 KiB |
| 01_rand_15.txt | AC | 7 ms | 4628 KiB |
| 01_rand_16.txt | AC | 9 ms | 4700 KiB |
| 02_max_rand_01.txt | AC | 31 ms | 6196 KiB |
| 02_max_rand_02.txt | AC | 28 ms | 5812 KiB |
| 02_max_rand_03.txt | AC | 9 ms | 5868 KiB |
| 02_max_rand_04.txt | AC | 7 ms | 5188 KiB |
| 02_max_rand_05.txt | AC | 7 ms | 3884 KiB |
| 02_max_rand_06.txt | AC | 10 ms | 4344 KiB |
| 02_max_rand_07.txt | AC | 5 ms | 4216 KiB |
| 02_max_rand_08.txt | AC | 7 ms | 4704 KiB |
| 03_two_even_01.txt | AC | 36 ms | 6452 KiB |
| 03_two_even_02.txt | AC | 25 ms | 5780 KiB |
| 03_two_even_03.txt | AC | 21 ms | 5132 KiB |
| 03_two_even_04.txt | AC | 26 ms | 5848 KiB |
| 03_two_even_05.txt | AC | 9 ms | 5908 KiB |
| 03_two_even_06.txt | AC | 8 ms | 5792 KiB |
| 03_two_even_07.txt | AC | 17 ms | 6456 KiB |
| 03_two_even_08.txt | AC | 16 ms | 6388 KiB |
| 03_two_even_09.txt | AC | 8 ms | 4408 KiB |
| 03_two_even_10.txt | AC | 10 ms | 4700 KiB |
| 03_two_even_11.txt | AC | 7 ms | 4144 KiB |
| 03_two_even_12.txt | AC | 9 ms | 4480 KiB |
| 03_two_even_13.txt | AC | 3 ms | 3944 KiB |
| 03_two_even_14.txt | AC | 3 ms | 4168 KiB |
| 03_two_even_15.txt | AC | 4 ms | 3916 KiB |
| 03_two_even_16.txt | AC | 4 ms | 4100 KiB |
| 04_other_01.txt | AC | 16 ms | 4480 KiB |
| 04_other_02.txt | AC | 15 ms | 4720 KiB |
| 04_other_03.txt | AC | 10 ms | 4172 KiB |
| 04_other_04.txt | AC | 23 ms | 5484 KiB |
| 04_other_05.txt | AC | 4 ms | 3908 KiB |
| 04_other_06.txt | AC | 6 ms | 4688 KiB |
| 04_other_07.txt | AC | 7 ms | 4872 KiB |
| 04_other_08.txt | AC | 9 ms | 4828 KiB |
| 04_other_09.txt | AC | 32 ms | 5896 KiB |
| 04_other_10.txt | AC | 20 ms | 4956 KiB |
| 04_other_11.txt | AC | 31 ms | 5884 KiB |
| 04_other_12.txt | AC | 27 ms | 5476 KiB |
| 04_other_13.txt | AC | 6 ms | 4892 KiB |
| 04_other_14.txt | AC | 11 ms | 5992 KiB |
| 04_other_15.txt | AC | 11 ms | 4976 KiB |
| 04_other_16.txt | AC | 15 ms | 5860 KiB |
| 05_test_01.txt | AC | 1 ms | 3704 KiB |
| 05_test_02.txt | AC | 1 ms | 3712 KiB |
| 05_test_03.txt | AC | 1 ms | 3476 KiB |
| 05_test_04.txt | AC | 24 ms | 6412 KiB |
| 05_test_05.txt | AC | 34 ms | 4716 KiB |
| 05_test_06.txt | AC | 34 ms | 4744 KiB |
| 05_test_07.txt | AC | 34 ms | 4688 KiB |
| 05_test_08.txt | AC | 35 ms | 4708 KiB |
| 05_test_09.txt | AC | 11 ms | 4704 KiB |
| 05_test_10.txt | AC | 11 ms | 4736 KiB |