Submission #4516344


Source Code Expand

Copy
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Queue;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.HashMap;
import java.util.TreeSet;

public class Main {
  static class Point{
    int x;
    int y;
    Point(int x, int y){
      this.x = x;
      this.y = y;
    }
  }
  static int[] dx = {0,1};
  static int[] dy = {1,0};
 	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int C = scanner.nextInt();
    int[] B = new int[M];
    for(int i = 0; i < M; i++){
      B[i] = scanner.nextInt();
    }
    int[][] A = new int[N][M];
    int[][] D = new int[N][M];
    int ans = 0;
    for(int i = 0; i < N; i++){
      int sum = C;
      for(int j = 0; j < M; j++){
        A[i][j] = scanner.nextInt();
        sum += A[i][j] * B[j];
      }
      if(sum > 0){
        ans++;
      }
    }
    System.out.println(ans);
  }
  static class UnionFind {
    int[] parent;
    public UnionFind(int size) {
      parent = new int[size];
      Arrays.fill(parent, -1);
    }
    public boolean unite(int x, int y) {
      x = root(x);
      y = root(y);
      if (x != y) {
        if (parent[y] < parent[x]) {
          int tmp = y;
          y = x;
          x = tmp;
        }
        parent[x] += parent[y];
        parent[y] = x;
        return true;
      }
      return false;
    }
    public boolean same(int x, int y) {
      return root(x) == root(y);
    }
    public int root(int x) {
      return parent[x] < 0 ? x : (parent[x] = root(parent[x]));
    }
    public int size(int x) {
      return -parent[root(x)];
    }
  }
  public static int upperBound(long[] a,long val){
    return upperBound(a,0,a.length,val);
  }
  public static int upperBound(long[] a,int l,int r,long val){
    if(r-l==1){
      if(a[l]>val) return l;
      return r;
    }
    int mid=(l+r)/2;
    if(a[mid]>val){
      return upperBound(a,l,mid,val);
    }else{
      return upperBound(a,mid,r,val);
    }
  }
  public static int lowerBound(long[] a,long val){
     return lowerBound(a,0,a.length,val);
 }
  public static int lowerBound(long[] a,int l,int r,long val){
    if(r-l==1){
      if(a[l]<val) return r;
      return l;
    }
    int mid=(l+r)/2;
    if(a[mid]<val){
      return lowerBound(a,mid,r,val);
    }else{
      return lowerBound(a,l,mid,val);
    }
  }
}

Submission Info

Submission Time
Task B - Can you solve this?
User rmkt
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 2625 Byte
Status
Exec Time 128 ms
Memory 23252 KB

Test Cases

Set Name Score / Max Score Test Cases
All 200 / 200 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 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
sample_01 119 ms 19796 KB
sample_02 95 ms 19412 KB
sample_03 97 ms 20564 KB
testcase_01 106 ms 23252 KB
testcase_02 101 ms 21332 KB
testcase_03 106 ms 21844 KB
testcase_04 114 ms 20308 KB
testcase_05 122 ms 20052 KB
testcase_06 126 ms 20308 KB
testcase_07 120 ms 21972 KB
testcase_08 118 ms 21972 KB
testcase_09 124 ms 21076 KB
testcase_10 124 ms 18900 KB
testcase_11 121 ms 22356 KB
testcase_12 128 ms 22484 KB
testcase_13 122 ms 19028 KB
testcase_14 109 ms 21588 KB