Submission #1610883
Source Code Expand
#include<cstdio> #include<cstdlib> #include<cmath> #include<iostream> #include<string> #include<stack> #include<queue> #include<vector> #include<map> #include<set> #include<algorithm> #include<numeric> #define rep(n) for(int i=0;i<n;i++) #define repp(j, n) for(int j=0;j<n;j++) #define reppp(i, m, n) for(int i=m;i<=n;i++) #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define pb(x) push_back(x) #define eb(x,y) emplace_back(x,y) #define MOD 1000000007 #define MAX 1001 #define INF 1410065408 #define EPS 1e-9 #define DEBUG 0 #define ll long long #define Pll pair<ll, ll> #define Pii pair<int, int> using namespace std; struct edge{int from, to; ll cost;}; signed main(){ int r, c, n; cin >> r >> c >> n; vector< vector<int> > matrix(r, vector<int>(c, -1)); vector<int> row(r, 0), column(c, 0); repp(k, n){ int i, j; cin >> i >> j; i--; j--; cin >> matrix[i][j]; if(i != 0 && matrix[i-1][j] != -1) row[i] = matrix[i][j] - matrix[i-1][j]; if(j != 0 && matrix[i][j-1] != -1) column[j] = matrix[i][j] - matrix[i][j-1]; } repp(i, r)repp(j, c){ if(matrix[i][j] == -1){ if(i > 0 && j > 0 && matrix[i-1][j-1] != -1 && matrix[i-1][j] != -1 && matrix[i][j-1] != -1){ if(matrix[i-1][j] + matrix[i][j-1] - matrix[i-1][j-1] < 0){ cout << "No" << endl; return 0; } } continue; } if(i > 0 && matrix[i-1][j] != -1 && matrix[i][j] - matrix[i-1][j] != row[i]){ cout << "No" << endl; return 0; } if(j > 0 && matrix[i][j-1] != -1 && matrix[i][j] - matrix[i][j-1] != column[j]){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Grid and Integers |
User | Noimin |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1918 Byte |
Status | RE |
Exec Time | 2653 ms |
Memory | 1557748 KB |
Judge Result
Set Name | Sample | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt, 1_29.txt, 1_30.txt, 1_31.txt, 1_32.txt, 1_33.txt, 1_34.txt, 1_35.txt, 1_36.txt, 1_37.txt, 1_38.txt, 1_39.txt, 1_40.txt, 1_41.txt, 1_42.txt, 1_43.txt, 1_44.txt, 1_45.txt, 1_46.txt, 1_47.txt, 1_48.txt, 1_49.txt, 1_50.txt, 1_51.txt, 1_52.txt, 1_53.txt, 1_54.txt, 1_55.txt, 1_56.txt, 1_57.txt, 1_58.txt, 1_59.txt, 1_60.txt, 1_61.txt, 1_62.txt, 1_63.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
0_03.txt | AC | 1 ms | 256 KB |
0_04.txt | AC | 1 ms | 256 KB |
1_00.txt | RE | 1865 ms | -495852 KB |
1_01.txt | TLE | 2553 ms | -494544 KB |
1_02.txt | TLE | 2628 ms | -494420 KB |
1_03.txt | TLE | 2653 ms | -494416 KB |
1_04.txt | TLE | 2478 ms | -494304 KB |
1_05.txt | TLE | 2306 ms | -494424 KB |
1_06.txt | TLE | 2539 ms | -494220 KB |
1_07.txt | RE | 1851 ms | -494288 KB |
1_08.txt | RE | 1987 ms | -494424 KB |
1_09.txt | RE | 1791 ms | -494452 KB |
1_10.txt | RE | 2045 ms | -494328 KB |
1_11.txt | RE | 1895 ms | -494348 KB |
1_12.txt | RE | 1918 ms | -494492 KB |
1_13.txt | RE | 1894 ms | -494432 KB |
1_14.txt | RE | 1884 ms | -494652 KB |
1_15.txt | RE | 1961 ms | -494544 KB |
1_16.txt | RE | 2010 ms | -494440 KB |
1_17.txt | RE | 1855 ms | -494532 KB |
1_18.txt | RE | 2075 ms | -494660 KB |
1_19.txt | RE | 1852 ms | -494256 KB |
1_20.txt | MLE | 1346 ms | -1537036 KB |
1_21.txt | TLE | 2394 ms | -494328 KB |
1_22.txt | MLE | 1425 ms | 1557748 KB |
1_23.txt | RE | 1806 ms | -494592 KB |
1_24.txt | TLE | 2162 ms | -564644 KB |
1_25.txt | RE | 1951 ms | -494592 KB |
1_26.txt | MLE | 329 ms | 387444 KB |
1_27.txt | RE | 2055 ms | -494708 KB |
1_28.txt | RE | 1802 ms | -494504 KB |
1_29.txt | RE | 1762 ms | -494564 KB |
1_30.txt | RE | 1761 ms | -494496 KB |
1_31.txt | RE | 1761 ms | -494312 KB |
1_32.txt | MLE | 562 ms | 992244 KB |
1_33.txt | RE | 1771 ms | -494312 KB |
1_34.txt | RE | 1899 ms | -494216 KB |
1_35.txt | WA | 101 ms | 10484 KB |
1_36.txt | RE | 1956 ms | -494084 KB |
1_37.txt | MLE | 702 ms | 1116148 KB |
1_38.txt | RE | 1771 ms | -493828 KB |
1_39.txt | RE | 1761 ms | -494056 KB |
1_40.txt | RE | 1858 ms | -494084 KB |
1_41.txt | RE | 1754 ms | -494104 KB |
1_42.txt | MLE | 1366 ms | -1722272 KB |
1_43.txt | RE | 1779 ms | -493900 KB |
1_44.txt | MLE | 1444 ms | -1430156 KB |
1_45.txt | AC | 144 ms | 249472 KB |
1_46.txt | RE | 1866 ms | -494080 KB |
1_47.txt | MLE | 321 ms | 592500 KB |
1_48.txt | MLE | 1145 ms | -1823872 KB |
1_49.txt | RE | 1876 ms | -493812 KB |
1_50.txt | RE | 1901 ms | -493628 KB |
1_51.txt | RE | 1867 ms | -494320 KB |
1_52.txt | RE | 1851 ms | -494204 KB |
1_53.txt | RE | 1764 ms | -493944 KB |
1_54.txt | RE | 1909 ms | -493960 KB |
1_55.txt | WA | 140 ms | 182900 KB |
1_56.txt | RE | 1798 ms | -493824 KB |
1_57.txt | RE | 1902 ms | -493968 KB |
1_58.txt | RE | 1851 ms | -493864 KB |
1_59.txt | RE | 1835 ms | -493872 KB |
1_60.txt | WA | 10 ms | 1908 KB |
1_61.txt | WA | 1 ms | 256 KB |
1_62.txt | AC | 1 ms | 256 KB |
1_63.txt | AC | 1 ms | 256 KB |