답안 #1030879

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030879 2024-07-22T11:14:47 Z vjudge1 City Mapping (NOI18_citymapping) C++17
32 / 100
1 ms 648 KB
 #include "citymapping.h"
#include <bits/stdc++.h>
using namespace std;
 
 
const int N = 1e3+5;
vector<int> adj[N];
int v[N], r[N], w[N]; 
vector<pair<long long int, int>> dis(N, {1e18+7, 0});
int pos = 0;
 
 
 
void find_roads(int n, int q, int A[], int B[], int W[]) {
    // vector<pair<long long int, int>> dis (n-1);
	long long int mx;
	int mp;
	mx = -1;
  mp = -1;
    for(int i = 0; i < n-1; i++){
        long long int d = get_distance(1, i+2);
        // dis[i]={d, i+2};
		if(d > mx){
			mx = d;
			mp=i+2;
		}
    }
	int rr = 0;
	for(int i = 0; i < n; i++){
		if(i+1 != mp){
			long long int d = get_distance(mp, i+1);
			dis[i-rr]={d, i+1};
		}
		else rr=1;
	}
    sort(dis.begin(), dis.end());

	A[0] = mp;
	long long int cnt = 0;
	for(int i = 0; i < n-1; i++){
		B[i] = dis[i].second;
		W[i] = (int) dis[i].first-cnt;
		if(i < n-2) A[i+1]=dis[i].second;
		cnt+=dis[i].first-cnt;
 	}

    // for(int i = 0; i < n-1; i++){
    //     cout << v[i] << " " << r[i] << " " << w[i] << endl;
    // }
    //int aa[n-1], bb[n-1], cc[n-1];
 
 
    // for(int i = 0; i < n-1; i++){
    //     aa[i] = v[i];
    //     bb[i] = r[i];
    //     cc[i] = w[i];
    //     // cout << v[i] << " " << r[i] << " " << w[i] << endl;
    // }
    // A = aa;
    // B = bb;
    // W = cc;
 
	// for (int i = 0; i < n - 1; i++) {
	// 	A[i] = v[i];
	// 	B[i] = r[i];
	// 	W[i] = w[i];
	// 	// cout << A[i] << " " << B[i] << " " << W[i] << endl;
	// }
	return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 604 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 604 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Correct: 1980 out of 12000 queries used.
2 Correct 1 ms 604 KB Correct: 1984 out of 12000 queries used.
3 Correct 1 ms 604 KB Correct: 1998 out of 12000 queries used.
4 Correct 1 ms 600 KB Correct: 1984 out of 12000 queries used.
5 Correct 1 ms 600 KB Correct: 1980 out of 12000 queries used.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Correct: 1980 out of 12000 queries used.
2 Correct 1 ms 604 KB Correct: 1984 out of 12000 queries used.
3 Correct 1 ms 604 KB Correct: 1998 out of 12000 queries used.
4 Correct 1 ms 600 KB Correct: 1984 out of 12000 queries used.
5 Correct 1 ms 600 KB Correct: 1980 out of 12000 queries used.
6 Correct 1 ms 604 KB Correct: 1994 out of 12000 queries used.
7 Correct 1 ms 648 KB Correct: 1990 out of 12000 queries used.
8 Correct 1 ms 604 KB Correct: 1998 out of 12000 queries used.
9 Correct 1 ms 604 KB Correct: 1992 out of 12000 queries used.
10 Correct 1 ms 604 KB Correct: 1986 out of 12000 queries used.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Correct: 1996 out of 500000 queries used.
2 Incorrect 1 ms 604 KB Reported list of edges differ from actual.
3 Halted 0 ms 0 KB -