結果
問題 | No.1837 Same but Different |
ユーザー |
|
提出日時 | 2022-02-11 23:18:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 1,037 bytes |
コンパイル時間 | 831 ms |
コンパイル使用メモリ | 105,472 KB |
実行使用メモリ | 18,000 KB |
最終ジャッジ日時 | 2024-06-27 21:40:37 |
合計ジャッジ時間 | 2,818 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 23 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using static System.Console;using System.Linq;using System.Collections.Generic;class Program{static int NN => int.Parse(ReadLine());static void Main(){var n = NN;var (a, b) = Same(n);WriteLine(string.Join(" ", a));WriteLine(string.Join(" ", b));}static (int[] a, int[] b) Same(int n){var a = new int[n];var b = new int[n];for (var i = 0; i < n; ++i){a[i] = 3 * (i + 1);b[i] = 3 * (i + 1) + 1;}a[n - 1] += 3;var rest = n - 3;if (n % 3 == 2){a[n - 2] += 10;a[n - 1] += 19;b[n - 2] += 12;b[n - 1] += 15;rest -= 2;}else if (n % 3 == 1){++a[n - 1];--rest;}for (var i = 0; i < n; ++i){if (rest <= 0) break;b[i] -= 3;rest -= 3;}return (a, b);}}