제출 #723691

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7236912023-04-14 07:36:32_martynas Martian DNA (BOI18_dna)C++11
100 / 100
140 ms5252 KiB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
using pii = pair<int, int>;
const int MXN = 2e5+5;
int n, k, r;
int A[MXN], req[MXN], tot[MXN], cnt[MXN];
int satisfied = 0;
int main() {
cin >> n >> k >> r;
for(int i = 0; i < n; i++) cin >> A[i];
for(int i = 0; i < n; i++) tot[A[i]]++;
for(int i = 0; i < r; i++) {
int a, b; cin >> a >> b;
req[a] = b;
if(tot[a] < b) {
cout << "impossible\n";
return 0;
}
}
auto add = [](int i) {
cnt[A[i]]++;
if(cnt[A[i]] == req[A[i]]) satisfied++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...