제출 #1127043

#제출 시각아이디문제언어결과실행 시간메모리
1127043RequiemAdriatic (CEOI13_adriatic)C++20
25 / 100
2102 ms187616 KiB
#include<bits/stdc++.h> //#define int long long #define pb push_back #define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); #define MOD 1000000007 #define inf 1e18 #define fi first #define se second #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORD(i,a,b) for(int i=a;i>=b;i--) #define sz(a) ((int)(a).size()) #define endl '\n' #define pi 3.14159265359 #define TASKNAME "bc" using namespace std; template<typename T> bool maximize(T &res, const T &val) { if (res < val){ res = val; return true; }; return false; } template<typename T> bool minimize(T &res, const T &val) { if (res > val){ res = val; return true; }; return false; } typedef pair<int,int> ii; typedef pair<int,ii> iii; typedef vector<int> vi; const int MAXN = 5e3 + 9; int n; int x[MAXN], y[MAXN], answer[MAXN]; int dist[5001][5001], g[5001][5001]; void bfs(int s, int dist[]){ queue<int> q; q.push(s); dist[s] = 0; while(!q.empty()){ int u = q.front(); answer[s] += dist[u]; q.pop(); for(int v = 1; v <= n; v++){ if (g[u][v] == 0) continue; if (minimize(dist[v], dist[u] + 1)){ q.push(v); } } } } namespace subtask1{ bool check(){ return n <= 5000; } void solve(){ FOR(i, 1, n){ FOR(j, i + 1, n) { if ((x[i] < x[j] and y[i] < y[j]) or (x[i] > x[j] and y[i] > y[j])){ g[i][j] = 1; g[j][i] = 1; } } } memset(dist, 0x3f, sizeof(dist)); FOR(i, 1, n){ bfs(i, dist[i]); } FOR(i, 1, n){ cout << answer[i] << endl; } } } main() { fast; if (fopen(TASKNAME".inp","r")){ freopen(TASKNAME".inp","r",stdin); freopen(TASKNAME".out","w",stdout); } cin >> n; FOR(i, 1, n){ cin >>x[i] >> y[i]; } if (subtask1::check()) return subtask1::solve(), 0; } /** Warning: Đọc sai đề??? Cận lmao Code imple thiếu case nào không. Limit. **/

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

adriatic.cpp:73:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   73 | main()
      | ^~~~
adriatic.cpp: In function 'int main()':
adriatic.cpp:77:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   77 |         freopen(TASKNAME".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
adriatic.cpp:78:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   78 |         freopen(TASKNAME".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...