답안 #473168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473168 2021-09-15T09:43:15 Z Mr_Ph San (COCI17_san) C++14
0 / 120
476 ms 15300 KB
///made by : Mr_Ph :D
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
const double PI=acos(-1.0);
const ll mod=(ll)1e9+7;
//int dx[4] = {0, 0, 1, -1};
//int dy[4] = {1, -1, 0, 0};
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
///the end of the defines ;)
void solve()
{
    int n,k;
    cin>>n>>k;
    vector<pair<int,int>>arr(n);
    for(int i=0; i<n; i++)
        cin>>arr[i].first>>arr[i].second;
    set<vector<int>>st;
    for(int i=0; i<(1<<n); i++)
    {
        vi temp;
        int sum=0;
        int prv=0;
        for(int e=0; e<n; e++)
        {
            int Try=(1<<e)&i;
            if(Try)
            {
                if(arr[e].first>=prv)
                {
                    prv=arr[e].first;
                    temp.push_back(e);
                    sum+=arr[e].second;
                }
            }
        }
        if(sum>=k)
            st.insert(temp);
    }
    cout<<st.sz<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    //freopen("window.in","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;//int st;
    //cin>>t;//cin>>st;
    while(t--)
        solve();
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 476 ms 15300 KB Output is correct
2 Incorrect 272 ms 288 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -