답안 #139664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139664 2019-08-01T08:38:11 Z mechfrog88 Exhibition (JOI19_ho_t2) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;

struct pic{
    ll v,s;
    bool operator <(const pic& rhs) const{
        return v < rhs.v;
    }
};


vector <pic> arr;
vector <ll> frame;

ll ans = 0;
ll n,m;

void func(ll i,vector<ll>s){
    if (i == n){
        ll j = 0;
        bool ok = false;
        for (int z=0;z<s.size() && j < m;z++,j++){
            while (j < m && s[z] > frame[j]){
                j++;
            }
            if (z == s.size()-1 && j < m){
                ok = true;
            }
        }
        if (ok) ans = max(ans,ll(s.size()));
        return;
    }
    func(i+1,s);
    s.push_back(arr[i].s);
    func(i+1,s);
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    arr.resize(n);
    for (int z=0;z<n;z++){
        cin >> arr[z].s >> arr[z].v;
    }
    frame.resize(m);
    for (int z=0;z<m;z++){
        cin >> frame[z];
    }
    sort(arr.begin(),arr.end());
    sort(frame.begin(),frame.end());
    vector <ll> temp;
    func(0,temp);
    cout << ans << endl;
}

Compilation message

joi2019_ho_t2.cpp: In function 'void func(ll, std::vector<long long int>)':
joi2019_ho_t2.cpp:34:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int z=0;z<s.size() && j < m;z++,j++){
                      ~^~~~~~~~~
joi2019_ho_t2.cpp:38:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (z == s.size()-1 && j < m){
                 ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -