제출 #44218

#제출 시각아이디문제언어결과실행 시간메모리
44218imaxblue새로운 문제 (POI11_pro)C++17
100 / 100
993 ms12716 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define x first #define y second #define pii pair<int, int> #define p3i pair<pii, int> #define pll pair<ll, ll> #define p3l pair<pll, ll> #define lseg L, (L+R)/2, N*2+1 #define rseg (L+R)/2+1, R, N*2+2 #define ub upper_bound #define lb lower_bound #define pq priority_queue #define MN 1000000007 #define fox(k, x) for (int k=0; k<x; ++k) #define fox1(k, x) for (int k=1; k<=x; ++k) #define foxr(k, x) for (int k=x-1; k>=0; --k) #define fox1r(k, x) for (int k=x; k>0; --k) #define ms multiset #define flood(x) memset(x, 0x3f3f3f3f, sizeof x) #define drain(x) memset(x, 0, sizeof x) #define rng() ((rand() << 14)+rand()) #define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0) char _; #define pi 3.14159265358979323846 ll ans, c; int n, m, k, t, e, a, b, N, D, P; int adj[1005][1005], cost[1005][1005], p[1005]; pq<p3i> q; bool u[1005]; void path(int N){ if (p[N]==-1) return; adj[p[N]][N]--; adj[N][p[N]]++; if (cost[p[N]][N]) cost[p[N]][N]++; path(p[N]); } bool get_path(){ while(q.size()) q.pop(); drain(u); q.push(mp(mp(0, 0), -1)); while(q.size()){ N=q.top().x.y; D=-q.top().x.x; P=q.top().y; q.pop(); if (u[N]) continue; u[N]=1; p[N]=P; if (N==1004){ path(N); //cout << "*" << D << endl; c+=D; ans++; return 1; } fox(l, 1005){ if (adj[N][l]){ q.push(mp(mp(-D-cost[N][l], l), N)); } } } return 0; } int main(){ scanf("%i%i%i%i%i", &n, &m, &k, &t, &e); fox1(l, n){ adj[0][l]=t/k; cost[0][l]=1; } fox1(l, m){ adj[l+n][1004]=1; } fox(l, e){ scanf("%i%i", &a, &b); adj[a][b+n]=1; } /*fox(l, n+1){ fox(l2, 10){ cout << adj[l][l2] << ' '; } cout << endl; }*/ while(get_path()); //cout << c << ' ' << k << endl; printf("%lli %lli\n", ans, c*k); fox1(l, n){ int x=0; fox1(l2, m){ if (adj[l2+n][l]){ printf("%i %i %i\n", l, l2, x*k); x++; } } } return 0; }

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

pro.cpp: In function 'int main()':
pro.cpp:65:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i%i%i%i", &n, &m, &k, &t, &e);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pro.cpp:74:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i%i", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...