Submission #147239

#TimeUsernameProblemLanguageResultExecution timeMemory
147239MatesV13Kocka (COCI18_kocka)C++11
70 / 70
203 ms17372 KiB
#include <bits/stdc++.h> using namespace std; int n, a[5][100000], maks, mini; vector<int> x[100005], y[100005]; int main (){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i=0; i<n; i++){ cin >> a[1][i]; if (a[1][i]==-1) continue; x[i].push_back(a[1][i]); y[a[1][i]].push_back(i); } for (int i=0; i<n; i++){ cin >> a[2][i]; if (a[2][i]==-1) continue; a[2][i]= n-a[2][i]-1; x[i].push_back(a[2][i]); y[a[2][i]].push_back(i); } for (int i=0; i<n; i++){ cin >> a[3][i]; if (a[3][i]==-1) continue; y[i].push_back(a[3][i]); x[a[3][i]].push_back(i); } for (int i=0; i<n; i++){ cin >> a[4][i]; if (a[4][i]==-1) continue; a[4][i]= n-a[4][i]-1; y[i].push_back(a[4][i]); x[a[4][i]].push_back(i); } bool ok=1; for (int i=0;i<n;i++){ mini = 100001; if (x[i].empty()) mini=-1; for (int j=0; j<x[i].size();j++) mini = min (mini, x[i][j]); if (mini!=a[1][i]) ok=0; } for (int i=0;i<n;i++){ maks = -1; for (int j=0; j<x[i].size();j++) maks = max (maks, x[i][j]); if (maks!=a[2][i]) ok=0; } for (int i=0;i<n;i++){ mini = 100001; if (y[i].empty()) mini=-1; for (int j=0; j<y[i].size();j++) mini = min (mini, y[i][j]); if (mini!=a[3][i]) ok=0; } for (int i=0;i<n;i++){ maks = -1; for (int j=0; j<y[i].size();j++) maks = max (maks, y[i][j]); if (maks!=a[4][i]) ok=0; } if (ok) cout << "DA"; else cout << "NE"; return 0; }

Compilation message (stderr)

kocka.cpp: In function 'int main()':
kocka.cpp:39:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j=0; j<x[i].size();j++) mini = min (mini, x[i][j]);
                 ~^~~~~~~~~~~~
kocka.cpp:44:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j=0; j<x[i].size();j++) maks = max (maks, x[i][j]);
                 ~^~~~~~~~~~~~
kocka.cpp:50:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j=0; j<y[i].size();j++) mini = min (mini, y[i][j]);
                 ~^~~~~~~~~~~~
kocka.cpp:55:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j=0; j<y[i].size();j++) maks = max (maks, y[i][j]);
                 ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...