結果
問題 | No.5004 Room Assignment |
ユーザー |
![]() |
提出日時 | 2021-12-01 00:55:09 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 623 ms / 5,000 ms |
コード長 | 1,319 bytes |
コンパイル時間 | 3,383 ms |
実行使用メモリ | 64,100 KB |
スコア | 647,361 |
平均クエリ数 | 7650.00 |
最終ジャッジ日時 | 2021-12-01 00:56:23 |
合計ジャッジ時間 | 70,285 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 100 |
ソースコード
import java.util.*;public class Main{public static void main(String arg[]){Scanner sc = new Scanner(System.in);int T = sc.nextInt();int R = sc.nextInt();int N = 5400;Node[] list = new Node[N];int user = 1;for(int i = 0; i < T; i++){int G = sc.nextInt();while(G > 0){int v = sc.nextInt();list[user - 1] = new Node(user, v);G--;user++;}if(i < T - 1){System.out.println("0");System.out.flush();}}Arrays.sort(list);ArrayList<String> output = new ArrayList<>();for(int i = 0; i < N / 4; i++){output.add(list[i * 4].no + " " + list[i * 4 + 1].no);output.add(list[i * 4 + 1].no + " " + list[i * 4 + 2].no);output.add(list[i * 4 + 2].no + " " + list[i * 4 + 3].no);}System.out.println(output.size());for(int i = 0; i < output.size(); i++){System.out.println(output.get(i));}System.out.flush();}}class Node implements Comparable<Node>{int no;int V;Node(int no, int V){this.no = no;this.V = V;}public int compareTo(Node ato){return this.V - ato.V;}}