Submission #139676

# Submission time Handle Problem Language Result Execution time Memory
139676 2019-08-01T08:50:44 Z mechfrog88 Exhibition (JOI19_ho_t2) C++14
10 / 100
1000 ms 504 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{
        if (v == rhs.v){
            return s < rhs.s;
        }
        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;
        for (ll z=0;z<s.size() && j < m;z++,j++){
            while (j < m && s[z] > frame[j]){
                j++;
            }
            if (j < m) ans = max(ans,z+1);
        }
        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:36:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (ll z=0;z<s.size() && j < m;z++,j++){
                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 416 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 416 KB Output is correct
11 Correct 2 ms 296 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 416 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 416 KB Output is correct
11 Correct 2 ms 296 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Execution timed out 1057 ms 504 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 416 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 416 KB Output is correct
11 Correct 2 ms 296 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Execution timed out 1057 ms 504 KB Time limit exceeded
21 Halted 0 ms 0 KB -