# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
873463 |
2023-11-15T06:33:20 Z |
vjudge1 |
Colors (RMI18_colors) |
C++17 |
|
91 ms |
2752 KB |
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define ent '\n'
#define all(x) x.begin(), x.end()
#define s second
#define f first
#define pb push_back
typedef long long ll;
using namespace std;
const int maxn = 2e7 + 250;
const int mod = 1e9 + 7;
const int inf = 1e9;
const int K = 400;
const double Pi = acos(-1.0);
const long double eps = 1e-9;
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define int long long
int a[maxn], b[maxn];
void solve() {
int n, m;
cin >> n >> m;
map<int,int>mp;
for(int i = 1;i <= n; i++) {
cin >> a[i];
mp[a[i]]++;
}
int ok = 1;
vector<pair<int,int>>v;
for(int i = 1;i <= n; i++) {
cin >> b[i];
v.push_back({b[i],i});
}
sort(all(v));
reverse(all(v));
for(int i = 1;i <= n; i++) {
int x, y;
cin >> x >> y;
}
for(int i = 0;i < n; i++) {
if(mp[v[i].f]>0) {
mp[a[v[i].s]]--;
a[v[i].s]=min(a[v[i].s], v[i].f);
mp[a[v[i].s]]++;
}
}
for(int i = 1;i <= n; i++) {
if(a[i]!=b[i])ok=0;
}
cout << ok << ent;
}
signed main () {
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// freopen("position.in", "r" , stdin);
// freopen("position.out", "w", stdout);
int t=1;
cin >> t;
for(int i = 1;i <= t; i++) {
// cout << "Case " << i << ": ";
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
2752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
2752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
91 ms |
2496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
51 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |