답안 #659380

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
659380 2022-11-17T14:58:09 Z vinnipuh01 Exhibition (JOI19_ho_t2) C++17
10 / 100
1000 ms 468 KB
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
#define int long long
#define sqrt sqrtl

using namespace std;

const long long oo = 1000000000000000000;

long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos;


/*
    ViHHiPuh

   (( `'-""``""-'` ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  / `;#'#'# - #'#'#;` \
 \_)) -----'#'----- ((_/
      # --------- #
  '# ------- ------ #'
  /..-'# ------- #'-.\
  _\...-\'# -- #'/-.../_
  ((____)- '#' -(____))


    cout << fixed << setprecision(6) << x;

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    freopen ( "sum.in", "r", stdin )
*/

vector <pair<int, int> > v;
vector <int> vv;
int mp[ 100001 ];

int a[ 100001 ], x, y, dp[ 100001 ], p[ 100001 ], d[ 100001 ], pr[ 100001 ], n, m;

void f( int o = 1, int sum = 0, int aa = 0, int b = 0 ) {
	if ( o == m + 1 ) {
		ans = max( ans, sum );
		return;
	}
	for ( int i = 0; i < v.size(); i ++ ) {
		if ( v[ i ].first <= a[ o ] && a[ o ] >= aa && v[ i ].second >= b && !mp[ i ] ) {
			mp[ i ] = 1;
			f( o + 1, sum + 1, a[ o ], v[ i ].second );
			mp[ i ] = 0;
		}
	}
	f( o + 1, sum, aa, b );
}

main () {
	cin >> n;
	cin >> m;
	for ( int i = 1; i <= n; i ++ ) {
		cin >> x >> y;
		v.push_back( { x, y } );
	}
	for ( int i = 1; i <= m; i ++ )
		cin >> a[ i ];
	sort( a + 1, a + m + 1 );
	f();
	cout << ans;
}

/*
8 8
14 4
13 20
12 3
23 10
22 6
18 19
15 1
5 16
11
24
2
21
8
9
17
7

*/

Compilation message

joi2019_ho_t2.cpp: In function 'void f(long long int, long long int, long long int, long long int)':
joi2019_ho_t2.cpp:58:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |  for ( int i = 0; i < v.size(); i ++ ) {
      |                   ~~^~~~~~~~~~
joi2019_ho_t2.cpp: At global scope:
joi2019_ho_t2.cpp:68:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   68 | main () {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 9 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 93 ms 296 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 9 ms 316 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 9 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 93 ms 296 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 9 ms 316 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 312 KB Output is correct
20 Execution timed out 1084 ms 468 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 9 ms 312 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 93 ms 296 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 308 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 9 ms 316 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 312 KB Output is correct
20 Execution timed out 1084 ms 468 KB Time limit exceeded
21 Halted 0 ms 0 KB -