제출 #1247003

#제출 시각아이디문제언어결과실행 시간메모리
1247003lukav모자이크 (IOI24_mosaic)C++20
22 / 100
95 ms26168 KiB
#include <bits/stdc++.h> using namespace std; string to_string(vector<int> numbers) { string text = "{"; for (auto i = numbers.begin(); i != numbers.end(); i++) { text += to_string(*i); //if (next(i) != numbers.end()) {text += ", "} } text += '}'; return text; } string to_string(vector<vector<int>> numbers) { string text = ""; for (auto i = numbers.begin(); i != numbers.end(); i++) { text += to_string(*i); if (next(i) != numbers.end()) {text += "\n";} } // text += '}'; return text; } vector<long long> mosaic(vector<int> X, vector<int> Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) { int n = X.size(), q = T.size(); vector<vector<int>> hormatrix(3, vector<int>(n)), vermatrix(n, vector<int>(3)); hormatrix[0] = X; for (int i = 0; i <= 2; i++) { hormatrix[i][0] = Y[i]; } for (int i = 1; i <= 2; i++) { for (int j = 1; j < n; j++) { if (hormatrix[i - 1][j] == 0 && hormatrix[i][j - 1] == 0) { hormatrix[i][j] = 1; } else {hormatrix[i][j] = 0;} } } for (int j = 0; j <= 2; j++) { vermatrix[0][j] = X[j]; } for (int i = 0; i < n; i++) { vermatrix[i][0] = Y[i]; } for (int i = 1; i < n; i++) { for (int j = 1; j <= 2; j++) { if (vermatrix[i - 1][j] == 0 && vermatrix[i][j - 1] == 0) { vermatrix[i][j] = 1; } else {vermatrix[i][j] = 0;} } } vector<long long> answers; for (int i = 0; i < q; i++) { int top = T[i], bottom = B[i], left = L[i], right = R[i]; if (top == bottom && left == right) { int answ; if (top > 2 && left > 2) { int minimum = min(top, left); top -= minimum - 2; left -= minimum - 2; } if (top <= 2) { answ = hormatrix[top][left]; } else if (left <= 2) { answ = vermatrix[top][left]; } answers.push_back(answ); } } //cout << to_string(hormatrix) << endl << endl << to_string(vermatrix) return answers; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...