# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733510 | rahulverma | Martian DNA (BOI18_dna) | Java | 1668 ms | 38176 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.
import java.io.*;
import java.util.*;
class dna {
public static void main(String[] args) {
// TODO Auto-generated method stub
// two pointers
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int k = s.nextInt();
int r = s.nextInt();
int[] freq = new int[k+5];
int[] req = new int[k+5];
int[] arr = new int[n];
for(int i = 0; i < n; i++) {
arr[i] = s.nextInt();
freq[arr[i]]++;
}
for(int i = 0; i < r; i++) {
int v1 = s.nextInt();
int v2 = s.nextInt();
req[v1] += v2;
}
for(int i = 0; i < k + 5; i++) {
if(freq[i] < req[i]) {
System.out.println("impossible");
return;
}
# | 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... |