제출 #341491

#제출 시각아이디문제언어결과실행 시간메모리
341491FlashGamezzz철로 (IOI14_rail)C++11
8 / 100
382 ms98412 KiB
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include "rail.h"

using namespace std;

int n, dists[5000][5000] = {};

void findLocation(int N, int first, int location[], int stype[]){
	n = N;
	for (int i = 0; i < n; i++){
		for (int j = i+1; j < n; j++){
			dists[i][j] = getDistance(i, j); dists[j][i] = dists[i][j];
		}
	}
	int diff = 10000000, cd = -1;
	for (int i = 1; i < n; i++){
		if (dists[0][i] < diff){
			diff = dists[0][i]; cd = i;
		}
	}
	location[0] = first; stype[0] = 1;
	for (int i = 1; i < n; i++){
		location[i] = first+getDistance(0, i); stype[i] = 2;
	}
	/*location[cd] = first+diff; stype[cd] = 2;
	for (int i = 1; i < n; i++){
		if (i != cd){
			if (dists[i][cd] < diff){
				location[i] = location[cd]-dists[i][cd]; stype[i] = 1;
			} else {
				int mv = 10000000, mi = -1;
				for (int j = 0; j < n; j++){
					if (j != i && dists[i][j] < mv){
						mv = dists[i][j]; mi = j;
					}
				}
				if (dists[i][cd] < dists[i][0]){ //left
					if (dists[mi][cd] < dists[i][cd]){ // C <- _D_ 0 D
						location[i] = first+diff-dists[mi][cd]+mv; stype[i] = 2;
					} else { // _C_ -> 0 D
						location[i] = first+diff-dists[i][cd]; stype[i] = 1;
					}
				} else { //right
					if (dists[mi][0] < dists[i][0]){ // 0 D _C_ -> D
						location[i] = first+dists[i][0]-mv; stype[i] = 1;
					} else { // 0 D _D_
						location[i] = first+dists[i][0]; stype[i] = 2;
					}
				}
			}
		}
	}*/
}

컴파일 시 표준 에러 (stderr) 메시지

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:22:23: warning: variable 'cd' set but not used [-Wunused-but-set-variable]
   22 |  int diff = 10000000, cd = -1;
      |                       ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...