提出 #74633096


ソースコード 拡げる

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

@SuppressWarnings("DuplicatedCode")
public class Main {
    static int MAX_STRING_LENGTH = (int) 1e6; // 字符串最大长度
    static int MAX_DIGIT_LENGTH = (int) 1e6; // 数位最大长度
    static int MOD7 = (int) 1e9 + 7, MOD8 = 80112002, MOD9 = 998244353, inf = Integer.MAX_VALUE;

    /***** 检查 T *****/
    static class Solution {

        void solve() {
            int n = io.nextInt(), m = io.nextInt(), s = io.nextInt();
            int[] a = io.nextIntArray(n);
            long ans = s;
            for (int i = 0; i < m; i++) {
                int id = io.nextInt() - 1, k = io.nextInt();
                ans += ((long) a[id] * k + 1) / 2;
            }
            io.println(ans);
        }


    }


    public static void main(String[] args) {
        io = new IO();
        int T = 1;
        // T = io.nextInt();
        for (; T > 0; T--) {
            new Solution().solve();
        }
        io.close();
    }

    static IO io;
    static class IO {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));

        int nextInt() {
            return (int) nextLong();
        }

        long nextLong() {
            try {
                long sign = 1, x = 0;
                int c = bis.read();
                while (c < '0' || c > '9') {
                    if (c == '-') sign = -1;
                    c = bis.read();
                }
                while (c >= '0' && c <= '9') {
                    x = x * 10 + (c - '0');
                    c = bis.read();
                }
                return sign * x;
            } catch (IOException e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                try {
                    int sign = 1, x = 0;
                    int c = bis.read();
                    while (c < '0' || c > '9') {
                        if (c == '-') sign = -1;
                        c = bis.read();
                    }
                    while (c >= '0' && c <= '9') {
                        x = x * 10 + (c - '0');
                        c = bis.read();
                    }
                    a[i] = sign * x;
                } catch (IOException e) {
                    throw new RuntimeException(e.getMessage());
                }
            }
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                try {
                    long sign = 1, x = 0;
                    int c = bis.read();
                    while (c < '0' || c > '9') {
                        if (c == '-') sign = -1;
                        c = bis.read();
                    }
                    while (c >= '0' && c <= '9') {
                        x = x * 10 + (c - '0');
                        c = bis.read();
                    }
                    a[i] = sign * x;
                } catch (IOException e) {
                    throw new RuntimeException(e.getMessage());
                }
            }
            return a;
        }

        int[] nextDigitArray(int n) {
            try {
                int[] a = new int[n];
                int x = bis.read();
                while (ignore(x)) {
                    x = bis.read();
                }
                int i = 0;
                while (!ignore(x)) {
                    a[i++] = x - '0';
                    x = bis.read();
                }
                return a;
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        private int[] DIGIT_ARRAY;

        int[] nextDigitArray() {
            try {
                if (DIGIT_ARRAY == null) {
                    DIGIT_ARRAY = new int[MAX_DIGIT_LENGTH];
                }
                int x = bis.read();
                while (ignore(x)) {
                    x = bis.read();
                }
                int m = 0;
                while (!ignore(x)) {
                    DIGIT_ARRAY[m++] = x - '0';
                    x = bis.read();
                }
                int[] a = new int[m];
                System.arraycopy(DIGIT_ARRAY, 0, a, 0, m);
                return a;
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        char nextChar() {
            try {
                int x = bis.read();
                while (ignore(x)) {
                    x = bis.read();
                }
                return (char) x;
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        String[] nextStringArray(int n) {
            String[] a = new String[n];
            for (int i = 0; i < n; i++) {
                try {
                    if (CHAR_ARRAY == null) {
                        CHAR_ARRAY = new char[MAX_STRING_LENGTH];
                    }
                    int x = bis.read();
                    while (ignore(x)) {
                        x = bis.read();
                    }
                    int m = 0;
                    while (x != ' ' && x != ',' && !ignore(x)) {
                        CHAR_ARRAY[m++] = (char) x;
                        x = bis.read();
                    }
                    a[i] = new String(CHAR_ARRAY, 0, m);
                } catch (IOException e) {
                    throw new RuntimeException(e.getMessage());
                }
            }
            return a;
        }

        private char[] CHAR_ARRAY;

        char[] nextCharArray(boolean line) {
            try {
                if (CHAR_ARRAY == null) {
                    CHAR_ARRAY = new char[MAX_STRING_LENGTH];
                }
                int x = bis.read();
                while (ignore(x)) {
                    x = bis.read();
                }
                int m = 0;
                while (line ? (x == ' ' || x == ',' || !ignore(x)) : !ignore(x)) {
                    CHAR_ARRAY[m++] = (char) x;
                    x = bis.read();
                }
                char[] a = new char[m];
                System.arraycopy(CHAR_ARRAY, 0, a, 0, m);
                return a;
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        char[] nextCharArray(int n) {
            try {
                char[] a = new char[n];
                int x = bis.read();
                while (ignore(x)) {
                    x = bis.read();
                }
                int i = 0;
                while (!ignore(x)) {
                    a[i++] = (char) x;
                    x = bis.read();
                }
                return a;
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        private boolean ignore(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        String nextString(boolean line) {
            return new String(nextCharArray(line));
        }

        String nextString() {
            return nextString(false);
        }

        boolean nextBoolean() {
            return "true".equalsIgnoreCase(nextString());
        }

        double nextDouble() {
            return Double.parseDouble(nextString());
        }

        void println(Object obj) {
            print(obj);
            print("\n");
        }

        void println() {
            print('\n');
        }

        void print(Object obj) {
            pw.print(obj);
        }

        void printf(String format, Object... obj) {
            pw.printf(format, obj);
        }

        void close() {
            try {
                if (bis != null) bis.close();
                if (pw != null) {
                    pw.flush();
                    pw.close();
                }
                bis = null;
                pw = null;
            } catch (Exception ignore) {
            }
        }
    }
}

提出情報

提出日時
問題 A - フリーマーケットの売上管理
ユーザ gaoyuliang
言語 Java24 (OpenJDK 24.0.2)
得点 266
コード長 8622 Byte
結果 AC
実行時間 102 ms
メモリ 40160 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 266 / 266
結果
AC × 3
AC × 67
セット名 テストケース
Sample sample01.txt, sample02.txt, sample03.txt
All sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in50.txt, in51.txt, in52.txt, in53.txt, in54.txt, in55.txt, in56.txt, in57.txt, in58.txt, in59.txt, in60.txt, in61.txt, in62.txt, in63.txt, in64.txt
ケース名 結果 実行時間 メモリ
in01.txt AC 46 ms 38040 KiB
in02.txt AC 41 ms 37972 KiB
in03.txt AC 42 ms 38144 KiB
in04.txt AC 41 ms 38168 KiB
in05.txt AC 41 ms 37888 KiB
in06.txt AC 41 ms 38244 KiB
in07.txt AC 102 ms 40040 KiB
in08.txt AC 62 ms 39496 KiB
in09.txt AC 44 ms 38280 KiB
in10.txt AC 92 ms 40072 KiB
in11.txt AC 92 ms 39960 KiB
in12.txt AC 85 ms 40064 KiB
in13.txt AC 90 ms 40092 KiB
in14.txt AC 91 ms 39944 KiB
in15.txt AC 69 ms 39380 KiB
in16.txt AC 41 ms 38240 KiB
in17.txt AC 89 ms 40116 KiB
in18.txt AC 68 ms 39224 KiB
in19.txt AC 95 ms 40160 KiB
in20.txt AC 86 ms 39788 KiB
in21.txt AC 102 ms 40100 KiB
in22.txt AC 89 ms 39812 KiB
in23.txt AC 97 ms 40148 KiB
in24.txt AC 87 ms 39788 KiB
in25.txt AC 67 ms 39396 KiB
in26.txt AC 40 ms 38368 KiB
in27.txt AC 40 ms 38216 KiB
in28.txt AC 39 ms 37944 KiB
in29.txt AC 63 ms 39300 KiB
in30.txt AC 43 ms 38300 KiB
in31.txt AC 96 ms 39916 KiB
in32.txt AC 69 ms 39412 KiB
in33.txt AC 71 ms 38972 KiB
in34.txt AC 40 ms 37920 KiB
in35.txt AC 40 ms 38096 KiB
in36.txt AC 96 ms 40072 KiB
in37.txt AC 39 ms 38372 KiB
in38.txt AC 38 ms 38144 KiB
in39.txt AC 39 ms 38260 KiB
in40.txt AC 43 ms 38484 KiB
in41.txt AC 40 ms 38252 KiB
in42.txt AC 98 ms 39960 KiB
in43.txt AC 68 ms 39136 KiB
in44.txt AC 98 ms 39932 KiB
in45.txt AC 98 ms 39828 KiB
in46.txt AC 97 ms 39836 KiB
in47.txt AC 92 ms 39868 KiB
in48.txt AC 94 ms 39776 KiB
in49.txt AC 85 ms 39596 KiB
in50.txt AC 68 ms 39004 KiB
in51.txt AC 92 ms 40016 KiB
in52.txt AC 67 ms 39052 KiB
in53.txt AC 95 ms 40076 KiB
in54.txt AC 40 ms 38116 KiB
in55.txt AC 40 ms 37976 KiB
in56.txt AC 41 ms 38040 KiB
in57.txt AC 41 ms 38180 KiB
in58.txt AC 40 ms 38320 KiB
in59.txt AC 40 ms 37968 KiB
in60.txt AC 41 ms 38176 KiB
in61.txt AC 40 ms 38228 KiB
in62.txt AC 56 ms 38520 KiB
in63.txt AC 41 ms 38040 KiB
in64.txt AC 101 ms 39924 KiB
sample01.txt AC 41 ms 37740 KiB
sample02.txt AC 41 ms 38012 KiB
sample03.txt AC 42 ms 37948 KiB