| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 28373 | Sorry AcornCkiGuiziTeam (#68) | Alternative Mart (FXCUP2_mart) | C++14 | 0 ms | 6840 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
priority_queue<pair<int, pair<int, int> > > pq;
vector<pair<int, int> > g[50005];
pair<int, int> d[50005][11];
int dn[50005];
int t[11];
int main() {
	int i, j, k, l, m, n;
	scanf("%d%d%d%d", &n, &m, &l, &k);
	while (l--) {
		scanf("%d", &i);
		pq.emplace(0, make_pair(i, -i));
	}
	while (m--) {
		scanf("%d%d%d", &i, &j, &l);
		g[i].emplace_back(j, l);
		g[j].emplace_back(i, l);
	}
	while (!pq.empty()) {
		auto p = pq.top();
		pq.pop();
		if (dn[p.second.first] == 11) continue;
		for (i = 0; i < dn[p.second.first]; i++) if (d[p.second.first][i].second == p.second.second) break;
		if (i < dn[p.second.first]) continue;
		d[p.second.first][dn[p.second.first]].first = -p.first;
		d[p.second.first][dn[p.second.first]].second = -p.second.second;
		dn[p.second.first]++;
		for (auto &t : g[p.second.first]) pq.emplace(p.first - t.second, make_pair(t.first, p.second.second));
	}
	while (k--) {
		scanf("%d%d", &i, &j);
		for (l = 0; l < j; l++) scanf("%d", &t[l]);
		for (l = 0;; l++) {
			for (m = 0; m < j; m++) if (t[m] == d[i][l].second) break;
			if (m == j) break;
		}
		printf("%d %d\n", d[i][l].second, d[i][l].first);
	}
	return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
