제출 #28427

#제출 시각아이디문제언어결과실행 시간메모리
28427AcornCkiGuiziTeam (#68)Oriental P.A.D.A.K (FXCUP2_padak)C++14
1 / 1
473 ms27780 KiB
#include <stdio.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #pragma warning(disable:4996) #pragma comment(linker, "/STACK:1048576") using namespace std; #define mp make_pair #define all(x) (x).begin(), (x).end() #define ldb ldouble typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; typedef pair <int, int> pii; typedef pair <ll, ll> pll; typedef pair <ll, int> pli; typedef pair <db, db> pdd; typedef tuple <int, int, int> t3; int IT_MAX = 1 << 17; const ll MOD = 1000000007; const int INF = 0x3f3f3f3f; const ll LL_INF = 0x3f3f3f3f3f3f3f3f; const db PI = acos(-1); const db ERR = 1e-10; #define szz(x) (int)(x).size() #define rep(i, n) for(int i=0;i<(n);i++) int dis[1000050]; vector <int> Vu; int cnt[2000050]; int ocnt[2000050]; int main() { int N, M, K, B, Z, i, j; scanf("%d %d %d %d %d", &N, &M, &K, &B, &Z); for (i = 0; i < N*M; i++) dis[i] = INF; while (K--) { scanf("%d %d", &i, &j); i--, j--; dis[i*M + j] = 0; Vu.emplace_back(i*M + j); } for (i = 0; i < Vu.size(); i++) { int x = Vu[i] / M, y = Vu[i] % M; int d = dis[Vu[i]]; for (j = 0; j < 4; j++) { int x2 = x + "1102"[j] - '1'; int y2 = y + "0211"[j] - '1'; if (x2 < 0 || x2 >= N || y2 < 0 || y2 >= M || dis[x2*M+y2] != INF) continue; dis[x2*M+y2] = d + 1; Vu.push_back(x2*M + y2); } } Vu.clear(); for (i = 0; i < 2000050; i++) ocnt[i] = cnt[i] = 0; for (i = 0; i < N*M; i++) ocnt[dis[i]]++; int a1 = 0, a2 = 0; int p = 1; for (i = 0; i <= 2000000; i++) cnt[i] = ocnt[i]; for (i = 1; i <= 2000000; i++) { if (p < i) p = i; int t = Z; while (p <= 2000000 && t) { int x = min(t, cnt[p]); a2 += x; cnt[p] -= x; t -= x; if (cnt[p] == 0) p++; } } p = 2000000; for (i = 0; i <= 2000000; i++) cnt[i] = ocnt[i]; for (i = 1; i <= 2000000; i++) { int t = Z; while (p >= i && t) { int x = min(t, cnt[p]); a1 += x; cnt[p] -= x; t -= x; if (cnt[p] == 0) p--; } } return !printf("%d %d\n", a1, a2); }

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

padak.cpp:23:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4996)  
 ^
padak.cpp:24:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/STACK:1048576")  
 ^
padak.cpp: In function 'int main()':
padak.cpp:66:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < Vu.size(); i++) {
                ^
padak.cpp:57:45: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d %d %d", &N, &M, &K, &B, &Z);
                                             ^
padak.cpp:61:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &i, &j);
                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...