Submission #1183585
Source Code Expand
#include<iostream> #include<string> #include<algorithm> #define REP(i,N) for(int i = 0; i < N; i++) using namespace std; // テンプレートここまで #define INF 100000001 typedef struct{ int x; int y; }Coord; int distance(Coord people,Coord point){ return abs(people.x - point.x) + abs(people.y - point.y); } int main(){ int n,m; Coord people[55]; Coord point[55]; cin >> n >> m; for(int i = 1; i <= n; i++){ cin >> people[i].x >> people[i].y; } for(int i = 1; i <= m; i++){ cin >> point[i].x >> point[i].y; } for(int i = 1; i <= n; i++){ int minDis = distance(people[i],point[1]); // int minDis = INF; int ansPoint = 1; for(int j = 1; j <= m; j++){ int tmpDis = distance(people[i],point[j]); // printf("%d,%d,%d\n",i,j,tmpDis); if(tmpDis < minDis){ minDis = tmpDis; ansPoint = j; } } cout << ansPoint << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Checkpoints |
User | homesentinel |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1092 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_1.txt | AC | 1 ms | 256 KB |
subtask_1_2.txt | AC | 1 ms | 256 KB |
subtask_1_3.txt | AC | 1 ms | 256 KB |
subtask_1_4.txt | AC | 1 ms | 256 KB |
subtask_1_5.txt | AC | 1 ms | 256 KB |
subtask_1_6.txt | AC | 1 ms | 256 KB |
subtask_1_7.txt | AC | 1 ms | 256 KB |