답안 #764088

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
764088 2023-06-23T07:02:53 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
18 ms 556 KB
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define forik(x) ll i = 1; i <= x; i++

const int mod = 1e9 + 7;

using namespace std;

ll n, k, p[100001], t[100001];
map <ll, ll> mp;

ll gcd (ll a, ll b){
	while (a > 0 && b > 0){
		if (a >= b){
			a %= b;
		}
		else{
			b %= a;
		}
	}
	return a + b;
}

ll binpow(ll a, ll b){
	a %= mod;
	if(b == 0){
		return 1;
	}
	if(b % 2 == 1){
		return binpow (a, b - 1) % mod * a;
	}
	if(b % 2 == 0){
		ll t = binpow(a, b / 2) % mod;
		return t * t % mod;
	}
}

signed main (){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++){
	cin >> p[i];
}
for (int i = 1; i <= n; i++){
	cin >> t[i];
}
for (int i = 1; i <= n; i++){
	if (p[i] < t[i]){
		for (int y = i + 1; y <= n; y++){
			if (p[y] == t[i] && mp[y] == 0){
				p[i] = t[i];
				mp[y] = 1;
				mp[i] = 1;
				break;
			}
		}
		for (int y = i - 1; y >= 1; y--){
			if (p[i] <= p[y] && p[y] == t[i] && mp[y] == 0){
				p[i] = t[i];
				mp[i] = 1;
				mp[y] = 1;
				break;
			}
		}
	}
	if (p[i] == t[i]){
		k++;
	}
}
cout << k;
}



Compilation message

exam.cpp: In function 'long long int binpow(long long int, long long int)':
exam.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 556 KB Output isn't correct
2 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -