Submission #4517069


Source Code Expand

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        int c = in.nextInt();

        int[] b = new int[m];
        for (int i = 0; i < m; i++) {
            b[i] = in.nextInt();
        }
        int x = 0;
        for (int i = 0; i < n; i++) {
            int r = 0;
            for (int j = 0; j < m; j++) {
                r += in.nextInt() * b[j];
            }
            r += c;
            if (r > 0) {
                x++;
            }
        }

        out.println(x);
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Submission Info

Submission Time
Task B - Can you solve this?
User mdstoy
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 2669 Byte
Status AC
Exec Time 82 ms
Memory 22740 KiB

Judge Result

Set Name All Sample
Score / Max Score 200 / 200 0 / 0
Status
AC × 17
AC × 3
Set Name Test Cases
All sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14
Sample sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 AC 71 ms 19796 KiB
sample_02 AC 69 ms 21076 KiB
sample_03 AC 69 ms 18900 KiB
testcase_01 AC 71 ms 22740 KiB
testcase_02 AC 68 ms 18260 KiB
testcase_03 AC 70 ms 21332 KiB
testcase_04 AC 72 ms 20180 KiB
testcase_05 AC 82 ms 21460 KiB
testcase_06 AC 72 ms 19924 KiB
testcase_07 AC 72 ms 19924 KiB
testcase_08 AC 81 ms 21460 KiB
testcase_09 AC 73 ms 21588 KiB
testcase_10 AC 73 ms 18644 KiB
testcase_11 AC 76 ms 20692 KiB
testcase_12 AC 82 ms 20820 KiB
testcase_13 AC 73 ms 20820 KiB
testcase_14 AC 71 ms 18644 KiB