結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
23,632 KB
testcase_01 AC 63 ms
21,528 KB
testcase_02 AC 62 ms
21,680 KB
testcase_03 WA -
testcase_04 AC 63 ms
21,696 KB
testcase_05 AC 63 ms
23,704 KB
testcase_06 AC 63 ms
23,580 KB
testcase_07 AC 65 ms
21,744 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 71 ms
23,916 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 101 ms
20,092 KB
testcase_16 AC 127 ms
22,168 KB
testcase_17 AC 83 ms
21,884 KB
testcase_18 AC 170 ms
22,252 KB
testcase_19 AC 114 ms
22,160 KB
testcase_20 AC 80 ms
22,032 KB
testcase_21 AC 74 ms
21,904 KB
testcase_22 AC 77 ms
21,952 KB
testcase_23 AC 72 ms
23,852 KB
testcase_24 AC 122 ms
22,048 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 133 ms
22,164 KB
testcase_28 AC 185 ms
22,280 KB
testcase_29 AC 132 ms
24,164 KB
testcase_30 WA -
testcase_31 AC 109 ms
22,356 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);
        int max = n;
        while (max > 0 && d[max - 1] > Math.Max(a[0] + b[1], a[1] + b[0])) --max;
        int ans = 0;
        for (int i = 0; i <= n; i++)
        {
            int k = n;
            for (int j = 0; j <= n; j++)
            {
                while (k > 0 && d[k - 1] > a[i] + b[j]) --k;

                if (k > 0)
                    ans = Math.Max(ans, Math.Min(i + j, max));
            }
        }
        Prt(ans);
    }
}

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