結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー りあんりあん
提出日時 2019-12-05 23:00:46
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 3,069 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 108,324 KB
実行使用メモリ 25,916 KB
最終ジャッジ日時 2023-09-06 07:51:27
合計ジャッジ時間 6,291 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,608 KB
testcase_01 AC 64 ms
21,780 KB
testcase_02 AC 61 ms
21,608 KB
testcase_03 AC 65 ms
21,612 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 66 ms
21,692 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 72 ms
23,800 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 76 ms
23,936 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 78 ms
21,828 KB
testcase_18 AC 105 ms
22,300 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 72 ms
21,852 KB
testcase_24 AC 89 ms
20,296 KB
testcase_25 WA -
testcase_26 AC 105 ms
20,300 KB
testcase_27 WA -
testcase_28 AC 100 ms
22,264 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 77 ms
24,292 KB
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using static util;

class Program {
    static void Main(string[] args) {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var solver = new Solver(sw);
        // var t = new Thread(solver.solve, 1 << 26); // 64 MB
        // t.Start();
        // t.Join();
        solver.solve();
        sw.Flush();
    }
}

class Solver {
    StreamWriter sw;
    Scan sc;
    void Prt(string a) => sw.WriteLine(a);
    void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    void Prt(params object[] a) => Prt(string.Join(" ", a));
    public Solver(StreamWriter sw) {
        this.sw = sw;
        this.sc = new Scan();
    }

    public void solve() {
        int n = sc.Int;
        var a = sc.IntArr;
        var b = sc.IntArr;
        var d = sc.IntArr;
        Array.Sort(d);
        var lis = new List<int>();
        int ai = 0, bi = 0;
        while (lis.Count < n) {
            if (a[ai + 1] + b[bi] >= a[ai] + b[bi + 1])
                ++ai;
            else ++bi;
            lis.Add(a[ai] + b[bi]);
        }
        for (int i = 0; i < n; i++)
        {
            bool ok = true;
            for (int j = 0; j <= i; j++)
                ok &= lis[j] >= d[i - j];

            if (!ok) {
                Prt(i);
                return;
            }
        }
        Prt(n);
    }
}

static class util {
    public static readonly int M = 1000000007;
}

class Scan {
    StreamReader sr;
    public Scan() { sr = new StreamReader(Console.OpenStandardInput()); }
    public Scan(string path) { sr = new StreamReader(path); }
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => sr.ReadLine().Trim();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); }
    public void Multi<T, U, V>(out T a, out U b, out V c)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); }
}
0