제출 #299432

#제출 시각아이디문제언어결과실행 시간메모리
299432FlashGamezzzJakarta Skyscrapers (APIO15_skyscraper)Java
컴파일 에러
0 ms0 KiB
#include <iostream> #include <cstdlib> #include <cstdio> #include <fstream> #include <algorithm> #include <string> #include <utility> #include <vector> #include <queue> #include <set> #include <map> #include <unordered_set> using namespace std; bool done[30000] = {}; int n, m, d0, d1, dists[30000] = {}, ans = -1; unordered_set<int> doges[30000]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; for (int i = 0; i < m; i++){ int a, b; cin >> a >> b; if (i == 0) d0 = a; if (i == 1) d1 = a; doges[a].insert(b); } for (int i = 0; i < n; i++){ dists[i] = 30001; } dists[d0] = 0; while (true){ int i = -1, md = 30001; for (int j = 0; j < n; j++){ if (!done[j] && dists[j] < md){ md = dists[i]; i = j; } } if (i == d1){ ans = dists[i]; break; } for (int p : doges[i]){ for (long ni = i % p; ni < n; ni+=p){ if (!done[ni] && dists[ni] > dists[i] + abs((i-ni)/p)){ dists[ni] = dists[i] + abs((i-ni)/p); } } } done[i] = true; } cout << ans << endl; }

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

skyscraper.java:1: error: illegal character: '#'
#include <iostream>
^
skyscraper.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
skyscraper.java:2: error: illegal character: '#'
#include <cstdlib>
^
skyscraper.java:3: error: illegal character: '#'
#include <cstdio>
^
skyscraper.java:4: error: illegal character: '#'
#include <fstream>
^
skyscraper.java:5: error: illegal character: '#'
#include <algorithm>
^
skyscraper.java:6: error: illegal character: '#'
#include <string>
^
skyscraper.java:7: error: illegal character: '#'
#include <utility>
^
skyscraper.java:8: error: illegal character: '#'
#include <vector>
^
skyscraper.java:9: error: illegal character: '#'
#include <queue>
^
skyscraper.java:10: error: illegal character: '#'
#include <set>
^
skyscraper.java:11: error: illegal character: '#'
#include <map>
^
skyscraper.java:12: error: illegal character: '#'
#include <unordered_set>
^
skyscraper.java:16: error: class, interface, or enum expected
bool done[30000] = {};
^
skyscraper.java:17: error: class, interface, or enum expected
int n, m, d0, d1, dists[30000] = {}, ans = -1;
^
skyscraper.java:18: error: class, interface, or enum expected
unordered_set<int> doges[30000];
^
skyscraper.java:20: error: class, interface, or enum expected
int main(){
^
skyscraper.java:22: error: class, interface, or enum expected
	cin.tie(NULL);
	^
skyscraper.java:23: error: class, interface, or enum expected
	cin >> n >> m;
	^
skyscraper.java:24: error: class, interface, or enum expected
	for (int i = 0; i < m; i++){
	^
skyscraper.java:24: error: class, interface, or enum expected
	for (int i = 0; i < m; i++){
	                ^
skyscraper.java:24: error: class, interface, or enum expected
	for (int i = 0; i < m; i++){
	                       ^
skyscraper.java:25: error: class, interface, or enum expected
		int a, b; cin >> a >> b;
		          ^
skyscraper.java:26: error: class, interface, or enum expected
		if (i == 0) d0 = a;
		^
skyscraper.java:27: error: class, interface, or enum expected
		if (i == 1) d1 = a;
		^
skyscraper.java:28: error: class, interface, or enum expected
		doges[a].insert(b);
		^
skyscraper.java:29: error: class, interface, or enum expected
	}
	^
skyscraper.java:30: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                ^
skyscraper.java:30: error: class, interface, or enum expected
	for (int i = 0; i < n; i++){
	                       ^
skyscraper.java:32: error: class, interface, or enum expected
	}
	^
skyscraper.java:34: error: class, interface, or enum expected
	while (true){
	^
skyscraper.java:36: error: class, interface, or enum expected
		for (int j = 0; j < n; j++){
		^
skyscraper.java:36: error: class, interface, or enum expected
		for (int j = 0; j < n; j++){
		                ^
skyscraper.java:36: error: class, interface, or enum expected
		for (int j = 0; j < n; j++){
		                       ^
skyscraper.java:38: error: class, interface, or enum expected
				md = dists[i]; i = j;
				               ^
skyscraper.java:39: error: class, interface, or enum expected
			}
			^
skyscraper.java:43: error: class, interface, or enum expected
			break;
			^
skyscraper.java:44: error: class, interface, or enum expected
		}
		^
skyscraper.java:46: error: class, interface, or enum expected
			for (long ni = i % p; ni < n; ni+=p){
			                      ^
skyscraper.java:46: error: class, interface, or enum expected
			for (long ni = i % p; ni < n; ni+=p){
			                              ^
skyscraper.java:49: error: class, interface, or enum expected
				}
				^
skyscraper.java:53: error: class, interface, or enum expected
	}
	^
skyscraper.java:55: error: class, interface, or enum expected
}
^
43 errors