Submission #1127984

#TimeUsernameProblemLanguageResultExecution timeMemory
1127984secretwood01Exhibition (JOI19_ho_t2)Java
0 / 100
55 ms10648 KiB
import java.util.*; import java.io.*; class Pic implements Comparable<Pic> { int s, v; public Pic(int s, int v) { this.s = s; this.v = v; } public int compareTo(Pic p) { if (v!=p.v) return Integer.compare(p.v, v); else return Integer.compare(s, p.s); } } public class joi2019_ho_t2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.nextToken()); Pic [] p = new Pic[N]; for (int i=0;i<N;i++) { st = new StringTokenizer(br.readLine()); p[i] = new Pic(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())); } int [] f = new int[M]; for (int i=0;i<M;i++) { f[i] = Integer.parseInt(br.readLine()); } br.close(); Arrays.sort(p); Arrays.sort(f); int ans = 0; int ind = M - 1; for (int i=0;i<N;i++) { if (p[i].s<=f[ind]) { ans++; ind--; if (ind<0) break; } } PrintWriter pw = new PrintWriter(System.out); pw.println(ans); pw.close(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...