제출 #329480

#제출 시각아이디문제언어결과실행 시간메모리
329480dolphingarlicCircus (Balkan15_CIRCUS)C++14
0 / 100
2111 ms524292 KiB
#include "circus.h" #include <bits/stdc++.h> using namespace std; int n, m, p[100001], mn[100000]; void init(int N, int M, int P[]){ n = N, m = M; memcpy(p, P, sizeof p); sort(p, p + n); p[n] = m; memset(mn, 0x3f, sizeof mn); priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; pq.push({mn[n] = 0, n}); while (pq.size()) { int cost, curr; tie(cost, curr) = pq.top(); pq.pop(); if (cost != mn[curr]) continue; for (int i = 0; i < n; i++) { if (abs(p[curr] - p[i]) >= cost && abs(p[curr] - p[i]) < mn[i]) { pq.push({mn[i] = abs(p[curr] - p[i]), i}); if (i > curr) break; } } } } int minLength(int D) { int ans = m - D; for (int i = 0; i < n; i++) if (abs(D - p[i]) >= mn[i]) { ans = min(ans, abs(D - p[i])); } return ans; }

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

grader.cpp: In function 'int main()':
grader.cpp:14:12: warning: unused variable 'max_code' [-Wunused-variable]
   14 |  long long max_code;
      |            ^~~~~~~~
grader.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |   scanf("%d", &P[i]);
      |   ~~~~~^~~~~~~~~~~~~
grader.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |  scanf("%d", &Q);
      |  ~~~~~^~~~~~~~~~
grader.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |   scanf("%d", &d);
      |   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...