제출 #1138014

#제출 시각아이디문제언어결과실행 시간메모리
1138014SmuggingSpunPinball (JOI14_pinball)C++20
11 / 100
2 ms396 KiB
#include<bits/stdc++.h> #define taskname "B" using namespace std; typedef long long ll; const ll INF = 1e18; int n, m; namespace sub1{ void solve(){ vector<int>a(n), b(n), c(n), d(n); for(int i = 0; i < n; i++){ cin >> a[i] >> b[i] >> c[i] >> d[i]; } ll ans = INF; for(int mask = (1 << n) - 1; mask > -1; mask--){ ll sum = 0; for(int i = 0; i < n; i++){ if(1 << i & mask){ sum += d[i]; } } if(sum < ans){ int pat = -1; for(int i = 1; i <= m; i++){ int x = i; for(int j = 0; j < n; j++){ if((1 << j & mask) && a[j] <= x && b[j] >= x){ x = c[j]; } } if(pat == -1){ pat = x; } else if(pat != x){ sum = -1; break; } } if(sum != -1){ ans = sum; } } } cout << (ans == INF ? -1 : ans); } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n >> m; if(n <= 10 && m <= 1000){ sub1::solve(); } }

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

pinball.cpp: In function 'int main()':
pinball.cpp:49:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...