Submission #3778070


Source Code Expand

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
	int N,M;
	cin >> N >> M;
	int a[50],b[50],c[50],d[50];
	for(int i=0; i<N; i++) cin >> a[i] >> b[i];
	for(int i=0; i<M; i++) cin >> c[i] >> d[i];

	for(int i=0; i<N; i++){
		int ans = 0;
		int m = INT_MAX;
		for(int j=0; j<M; j++){
			if(abs(a[i]-c[j])+abs(b[i]-d[j]) < m){
				ans = j;
				m = abs(a[i]-c[j])+abs(b[i]-d[j]);
			}
		}
		cout << ans << endl;
	}
}

Submission Info

Submission Time
Task B - Checkpoints
User Pro_ktmr
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1083 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
WA × 3
WA × 10
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 WA 1 ms 256 KB
sample_02.txt WA 1 ms 256 KB
sample_03.txt WA 1 ms 256 KB
subtask_1_1.txt WA 1 ms 256 KB
subtask_1_2.txt WA 1 ms 256 KB
subtask_1_3.txt WA 1 ms 256 KB
subtask_1_4.txt WA 1 ms 256 KB
subtask_1_5.txt WA 1 ms 256 KB
subtask_1_6.txt WA 1 ms 256 KB
subtask_1_7.txt WA 1 ms 256 KB