답안 #922057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
922057 2024-02-05T00:13:13 Z jpfr12 Pohlepko (COCI16_pohlepko) C++17
40 / 80
54 ms 65536 KB
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#include <fstream>
#include <bitset>
#include <iomanip>
 
typedef long long ll;
using namespace std;
int MOD = (int)1e9;
int MAXN = 1e6;
 
//classes

 
 
//global



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //ifstream fin("teamwork.in");
  //ofstream fout("teamwork.out");
  //stop
  int n, m;
  cin >> n >> m;
  vector<string> vec(n);
  for(string& i: vec) cin >> i;
  vector<vector<string>> dp(n, vector<string>(m, ""));
  //first row
  for(int i = 0; i < m; i++){
    if(i == 0) dp[0][0] += vec[0][0];
    else dp[0][i] = dp[0][i-1] + vec[0][i];
  }
  //first col
  for(int i = 1; i < n; i++){
    dp[i][0] = dp[i-1][0] + vec[i][0];
  }
  
  for(int i = 1; i < n; i++){
    for(int j = 1; j < m; j++){
      dp[i][j] = min(dp[i-1][j] + vec[i][j], dp[i][j-1] + vec[i][j]);
    }
  }
  cout << dp[n-1][m-1] << '\n';
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 708 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 4 ms 5232 KB Output is correct
6 Runtime error 54 ms 65536 KB Execution killed with signal 9
7 Runtime error 38 ms 65536 KB Execution killed with signal 9
8 Runtime error 35 ms 65536 KB Execution killed with signal 9
9 Correct 3 ms 1116 KB Output is correct
10 Correct 19 ms 18524 KB Output is correct
11 Runtime error 49 ms 65536 KB Execution killed with signal 9
12 Runtime error 51 ms 65536 KB Execution killed with signal 9
13 Runtime error 49 ms 65536 KB Execution killed with signal 9
14 Runtime error 33 ms 65536 KB Execution killed with signal 9
15 Correct 3 ms 2908 KB Output is correct
16 Runtime error 34 ms 65536 KB Execution killed with signal 9