제출 #131335

#제출 시각아이디문제언어결과실행 시간메모리
131335Just_Solve_The_ProblemPinball (JOI14_pinball)C++11
11 / 100
5 ms504 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = (int)1e5 + 7; int n, m; int a[maxn], b[maxn], c[maxn], d[maxn]; int used[maxn]; main() { scanf("%d %d", &m, &n); for (int i = 0; i < m; i++) { scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]); } if (m > 10) return 0; ll ans = 1e18; for (int mask = 0; mask < (1 << m); mask++) { ll res = 0; for (int i = 1; i <= n; i++) { used[i] = -1; } for (int i = 0; i < m; i++) { if ((mask >> i) & 1) { bool ok = 0; for (int j = a[i]; j <= b[i]; j++) { ok |= (used[j] == -1); used[j] = 0; } if (ok) used[c[i]] = -1; res += d[i]; } } int ok = 0; for (int j = 1; j <= n; j++) { ok += (used[j] == -1); } if (ok == 1) { ans = min(ans, res); } } if (ans == (ll)1e18) ans = -1; printf("%lld", ans); }

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

pinball.cpp:13:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
pinball.cpp: In function 'int main()':
pinball.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &m, &n);
   ~~~~~^~~~~~~~~~~~~~~~~
pinball.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...