Submission #19725725


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int H, W;
 cin >> H >>W;
 
  vector<vector<int>> A(H,vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A.at(i).at(j);
    }
  }
  
  int min = 100;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if(min > A.at(i).at(j)){
        min = A.at(i).at(j);
      }
    }
  }
  
  int sum;
   for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      sum += A.at(i).at(j);
    }
   }
 cout << sum - min * H * W << endl; 
}
  

Submission Info

Submission Time
Task B - Blocks on Grid
User kamiya_shake
Language C++ (GCC 9.2.1)
Score 200
Code Size 592 Byte
Status AC
Exec Time 9 ms
Memory 3624 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:26: warning: ‘sum’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |  cout << sum - min * H * W << endl;
      |                          ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 14
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 9 ms 3592 KB
random_02.txt AC 2 ms 3472 KB
random_03.txt AC 2 ms 3616 KB
random_04.txt AC 2 ms 3624 KB
random_05.txt AC 2 ms 3424 KB
random_06.txt AC 2 ms 3556 KB
random_07.txt AC 2 ms 3424 KB
random_08.txt AC 2 ms 3528 KB
random_11.txt AC 4 ms 3616 KB
random_12.txt AC 5 ms 3592 KB
random_13.txt AC 9 ms 3512 KB
sample_01.txt AC 1 ms 3404 KB
sample_02.txt AC 2 ms 3552 KB
sample_03.txt AC 2 ms 3592 KB