結果
問題 |
No.3012 岩井星人グラフ
|
ユーザー |
![]() |
提出日時 | 2025-01-28 08:56:41 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,789 bytes |
コンパイル時間 | 2,867 ms |
コンパイル使用メモリ | 89,168 KB |
実行使用メモリ | 81,852 KB |
最終ジャッジ日時 | 2025-01-28 08:56:57 |
合計ジャッジ時間 | 14,612 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 23 |
ソースコード
import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); List<Path> ans = new ArrayList<>(); for (int i = 0; i < n; i++) { ans.add(new Path(i + 1, (i + 1) % n + 1)); for (int j = 1; j < m; j++) { ans.add(new Path(i + 1, i + j * n + 1)); } } System.out.println(n * m + " " + (n * m)); System.out.println(ans.stream().map(x -> x.toString()).collect(Collectors.joining("\n"))); } static class Path { int left; int right; public Path(int left, int right) { this.left = left; this.right = right; } public String toString() { return left + " " + right; } } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }