Submission #16267250
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;bool match_sign(int dx, int dy, int m,const vector<int> &sign_x_vec, const vector<int> &sign_y_vec,const set<pair<int, int>> &pict_set){for (int i = 1; i < m; ++i) {int x = sign_x_vec.at(i) + dx;int y = sign_y_vec.at(i) + dy;if (!pict_set.count({x, y}))return false;}return true;}int main(){int m;cin >> m;int x, y;
#include <bits/stdc++.h> using namespace std; bool match_sign(int dx, int dy, int m, const vector<int> &sign_x_vec, const vector<int> &sign_y_vec, const set<pair<int, int>> &pict_set) { for (int i = 1; i < m; ++i) { int x = sign_x_vec.at(i) + dx; int y = sign_y_vec.at(i) + dy; if (!pict_set.count({x, y})) return false; } return true; } int main() { int m; cin >> m; int x, y; vector<int> sign_x_vec(m), sign_y_vec(m); for (int i = 0; i < m; ++i) { cin >> x >> y; sign_x_vec.at(i) = x; sign_y_vec.at(i) = y; } int n; cin >> n; vector<int> pict_x_vec(n), pict_y_vec(n); set<pair<int, int>> pict_set; for (int i = 0; i < n; ++i) { cin >> x >> y; pict_x_vec.at(i) = x; pict_y_vec.at(i) = y; pict_set.insert({x, y}); } for (int i = 0; i < n; ++i) { int dx = pict_x_vec.at(i) - sign_x_vec.at(0); int dy = pict_y_vec.at(i) - sign_y_vec.at(0); if (match_sign(dx, dy, m, sign_x_vec, sign_y_vec, pict_set)) { cout << dx << " " << dy << endl; return 0; } } }
Submission Info
Submission Time | |
---|---|
Task | D - 星座探し |
User | atug |
Language | C++ (GCC 9.2.1) |
Score | 100 |
Code Size | 1184 Byte |
Status | AC |
Exec Time | 13 ms |
Memory | 3596 KB |
Judge Result
Set Name | set01 | set02 | set03 | set04 | set05 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 20 / 20 | 20 / 20 | 20 / 20 | 20 / 20 | 20 / 20 | ||||||||||
Status |
|
|
|
|
|
Set Name | Test Cases |
---|---|
set01 | data1 |
set02 | data2 |
set03 | data3 |
set04 | data4 |
set05 | data5 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
data1 | AC | 8 ms | 3544 KB |
data2 | AC | 1 ms | 3368 KB |
data3 | AC | 6 ms | 3536 KB |
data4 | AC | 4 ms | 3596 KB |
data5 | AC | 13 ms | 3592 KB |