답안 #1057539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1057539 2024-08-13T21:19:02 Z beaconmc Gift Exchange (JOI24_ho_t4) C++14
50 / 100
2500 ms 4956 KB
#include <bits/stdc++.h>
 
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	vector<ll> vals(n), req(n);
	FOR(i,0,n) cin >> vals[i];
	FOR(i,0,n) cin >> req[i];
	ll q;
	cin >> q;
	FOR(i,0,q){
		ll a,b;
		cin >> a >> b;
		a--;b--;
		vector<ll> idk, idk2;
		bool flag = false;
		FOR(j,a,b+1){
			idk.push_back(vals[j]);
			idk2.push_back(req[j]);
		}
		sort(idk.begin(), idk.end());
		sort(idk2.begin(), idk2.end());
		ll l = idk.size()-1;

		vector<bool> visited(idk.size());

		FORNEG(j, idk.size()-1, 0){
			if (idk2[j] <= idk[j-1]) visited[j] = 1, visited[j-1] = 1;
		}
		ll sumz = 0;
		for (auto i : visited) sumz += i;

		if (sumz==idk.size()) cout << "Yes" << "\n";
		else cout << "No" << "\n";

	}




}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:42:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |   if (sumz==idk.size()) cout << "Yes" << "\n";
      |       ~~~~^~~~~~~~~~~~
Main.cpp:25:8: warning: unused variable 'flag' [-Wunused-variable]
   25 |   bool flag = false;
      |        ^~~~
Main.cpp:32:6: warning: unused variable 'l' [-Wunused-variable]
   32 |   ll l = idk.size()-1;
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 20 ms 3832 KB Output is correct
5 Correct 20 ms 3820 KB Output is correct
6 Correct 20 ms 3788 KB Output is correct
7 Correct 20 ms 3832 KB Output is correct
8 Correct 25 ms 3824 KB Output is correct
9 Correct 20 ms 3792 KB Output is correct
10 Correct 20 ms 3828 KB Output is correct
11 Correct 23 ms 4692 KB Output is correct
12 Correct 20 ms 4804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 20 ms 3832 KB Output is correct
38 Correct 20 ms 3820 KB Output is correct
39 Correct 20 ms 3788 KB Output is correct
40 Correct 20 ms 3832 KB Output is correct
41 Correct 25 ms 3824 KB Output is correct
42 Correct 20 ms 3792 KB Output is correct
43 Correct 20 ms 3828 KB Output is correct
44 Correct 23 ms 4692 KB Output is correct
45 Correct 20 ms 4804 KB Output is correct
46 Correct 39 ms 3120 KB Output is correct
47 Correct 34 ms 3212 KB Output is correct
48 Correct 14 ms 2520 KB Output is correct
49 Correct 27 ms 3256 KB Output is correct
50 Correct 53 ms 4368 KB Output is correct
51 Correct 47 ms 4256 KB Output is correct
52 Correct 7 ms 1624 KB Output is correct
53 Correct 13 ms 2520 KB Output is correct
54 Correct 119 ms 4788 KB Output is correct
55 Correct 119 ms 4956 KB Output is correct
56 Correct 49 ms 4484 KB Output is correct
57 Correct 47 ms 4380 KB Output is correct
58 Correct 37 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 2552 ms 4468 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Execution timed out 2552 ms 4468 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 20 ms 3832 KB Output is correct
38 Correct 20 ms 3820 KB Output is correct
39 Correct 20 ms 3788 KB Output is correct
40 Correct 20 ms 3832 KB Output is correct
41 Correct 25 ms 3824 KB Output is correct
42 Correct 20 ms 3792 KB Output is correct
43 Correct 20 ms 3828 KB Output is correct
44 Correct 23 ms 4692 KB Output is correct
45 Correct 20 ms 4804 KB Output is correct
46 Correct 39 ms 3120 KB Output is correct
47 Correct 34 ms 3212 KB Output is correct
48 Correct 14 ms 2520 KB Output is correct
49 Correct 27 ms 3256 KB Output is correct
50 Correct 53 ms 4368 KB Output is correct
51 Correct 47 ms 4256 KB Output is correct
52 Correct 7 ms 1624 KB Output is correct
53 Correct 13 ms 2520 KB Output is correct
54 Correct 119 ms 4788 KB Output is correct
55 Correct 119 ms 4956 KB Output is correct
56 Correct 49 ms 4484 KB Output is correct
57 Correct 47 ms 4380 KB Output is correct
58 Correct 37 ms 4216 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Execution timed out 2552 ms 4468 KB Time limit exceeded
63 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 20 ms 3832 KB Output is correct
38 Correct 20 ms 3820 KB Output is correct
39 Correct 20 ms 3788 KB Output is correct
40 Correct 20 ms 3832 KB Output is correct
41 Correct 25 ms 3824 KB Output is correct
42 Correct 20 ms 3792 KB Output is correct
43 Correct 20 ms 3828 KB Output is correct
44 Correct 23 ms 4692 KB Output is correct
45 Correct 20 ms 4804 KB Output is correct
46 Correct 39 ms 3120 KB Output is correct
47 Correct 34 ms 3212 KB Output is correct
48 Correct 14 ms 2520 KB Output is correct
49 Correct 27 ms 3256 KB Output is correct
50 Correct 53 ms 4368 KB Output is correct
51 Correct 47 ms 4256 KB Output is correct
52 Correct 7 ms 1624 KB Output is correct
53 Correct 13 ms 2520 KB Output is correct
54 Correct 119 ms 4788 KB Output is correct
55 Correct 119 ms 4956 KB Output is correct
56 Correct 49 ms 4484 KB Output is correct
57 Correct 47 ms 4380 KB Output is correct
58 Correct 37 ms 4216 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Execution timed out 2552 ms 4468 KB Time limit exceeded
63 Halted 0 ms 0 KB -