답안 #908855

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908855 2024-01-17T00:46:46 Z vjudge1 Pinball (JOI14_pinball) C++17
0 / 100
6 ms 348 KB
#include<bits/stdc++.h>
#define endl '\n'
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define fore(i,l,r) for(int i = l; i < r;i++)
#define fo(i,n) fore(i,0,n)
#define ll long long
#define ii pair<int,int>
using namespace std;
using vi = vector<int>;
struct cosa{
    int a,b,c,d;
};
vector<cosa> arr;
int main() {
    int m,n;
    cin >> m >> n;
    ll ans = 1e18;
    fo(i,m){
        cosa a;
        cin >> a.a >> a.b >> a.c >> a.d;
        arr.pb(a);
    }
    for(int bit = 1; bit <= (1<<m)-1; bit++){
        vector<int> act(n+23,0);ll cost = 0;
        fore(i,1,n+1)act[i]=i;
        for(int j = 0 ; j < m; j++){
            if(bit&(1<<j)){
                cosa a = arr[j];cost+=a.d;
                for(int i = 1; i <= n;i++){
                    if(act[i] <= a.b and a.a <= act[i]){
                        act[i]=a.c;
                    }
                }
            }
        }
        // for(int i = 1; i <=n;i++)cout<<act[i]<<" ";
        // cout<<endl;
        bool f = true;
        for(int i = 1;i <= n;i++)if(act[i]!=act[1])f=false;
        if(f){
            ans = min(ans, cost);
        }
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 6 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 6 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 6 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Incorrect 6 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -