Submission #336227

# Submission time Handle Problem Language Result Execution time Memory
336227 2020-12-15T03:10:07 Z knightron0 Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define printvector(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl;
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long
#define printarray(arr, n) for(int i= 0;i<n;i++) cout<<arr[i]<<' '; cout<<endl;
#define printvecpairs(vec) for(auto it: vec) cout<<it.fr<<' '<<it.sc<<endl;
#define initdp(a) memset(a, -1, sizeof(a));
#define endl '\n'
#define float long double

using namespace std;
const int MOD = 1e9 + 7;
const int INF = 2e15;
const int MAXN = 1005;

int fastexpo(int b, int exp){
    if(exp == 0) return 1;
    if(exp == 1) return b;
    int ans = (fastexpo(b,exp/2) % MOD);
    ans *= ans;
    ans %= MOD;
    if(exp % 2 == 1){
        ans *= b;
    }
    ans %= MOD;
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	vector<pair<int, int> > b;
	int n, m;
    cin>>m>>n;
    int a[n];
    for(int i = 0;i<m;i++){
    	int t1, t2;
    	cin>>t1>>t2;
    	b.pb(mp(t2, t1));
    }
    for(int i= 0;i<n;i++){
    	cin>>a[i];
    }
    sort(all(b));
    sort(a, a+n);
    int dp[n+1][m+1];
    clr(dp);
    for(int i= 1;i<=n;i++){
    	for(int j =1;j<=m;j++){
    		if(a[i-1]>=b[j-1].sc){
    			dp[i][j] = max(1 + dp[i-1][j-1], dp[i-1][j]);
    		} else {
    			dp[i][j] = dp[i-1][j];
    		}
    	}
    }
    cout<<dp[n][m]<<endl;
    return 0;
}



# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 0 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 0 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Incorrect 0 ms 364 KB Output isn't correct
8 Halted 0 ms 0 KB -