Submission #833487

# Submission time Handle Problem Language Result Execution time Memory
833487 2023-08-22T06:09:47 Z vjudge1 Exam (eJOI20_exam) C++17
12 / 100
17 ms 1876 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define ld long double
#define pb push_back
#define endl '\n'
#define all(v) v.begin(), v.end()
#define fr(m,n,k) for(int m=n;m<=k;m++)
#define frr(m,n,k) for(int m=n;m>=k;m--)
#define yes cout << "YES"
#define no cout << "NO"
#define yesm cout << "Yes"
#define nom cout << "No"
#define inf 1e18
#define ext {cout << -1; return;}
#define zxt {cout << 0; return;}
#define noxt {no;return;}
#define yesxt {yes;return;}
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define rall(a) a.rbegin(),a.rend()
#define lb lower_bound
#define ub upper_bound
#define pi pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vc vector<char>
#define vb vector<bool>
#define vs vector<string>
#define vpi vector<pi>
#define pq priority_queue
#define mii map<int,int>
#define mivi map<int,vi>
#define mci map<char,int>
#define als(i) cout << i.fi << " " << i.se << endl
#define si set<int>
#define msi multiset<int>
#define fi first
#define wq while(q--)
#define se second
#define sz size()
#define el cout<<endl

bool id = 0, id1 = 0,  id2 = 0;
int x = 0, y = 0, z = 0, tp;
int ans = 0, num = 0, sum = 0, mo = 0, me = 0, cnt = 0, mi = inf, ma = 0;
string s = "", p = "", st = "";
int h = 0, w = 0, n = 0, m = 0, t = 0, k = 0, i = 0, j = 0, l = 0, r = 0, q = 0, a = 0, b = 0, c = 0, d = 0;

const int mod = 1e9 + 7;
// const int mod = 998244353;

ll fac(ll n) {ll ans = 1; for (int i = 1; i <= n; ++i) {ans = ans * i;} return ans;}
int binpow(int x, int y) {if (y == 0) return 1; int z = 1; while (y) {	if (y & 1) z = z * x % mod; x = x * x % mod; y >>= 1;} return z;}
int inv(int x) {return binpow(x, mod - 2);}
int bintoint(string s) {reverse(all(s)); int xx = 0; int m = 1; int z = s.sz; fr(j, 0, z) {xx += (s[j] == '1' ? m : 0); m <<= 1;} return xx;}
string inttobin(int x) {if (x == 0) return "0"; string s; while (x) {s += (x & 1) + '0'; x >>= 1;} reverse(all(s)); return s;}
int add(int x, int y) {int zz = ((x + y) % mod + mod) % mod; return zz;}
string ads(string s, string p) {if (s.sz > p.sz)swap(s, p); int n = s.sz, m = p.sz; reverse(all(s)); reverse(all(p)); int tm = 0; string st; fr(i, 0, n) {int k = s[i] - '0' + p[i] - '0' + tm; st += ('0' + k % 10); tm = k / 10;} fr(i, n, m) {    int k = p[i] - '0' + tm; st += ('0' + k % 10); tm = k / 10;} if (tm) st += (tm + '0'); reverse(all(st)); return st;}

const int N = 1e6 + 5;
void solve() {
	h = 0, w = 0, n = 0, m = 0, t = 0, k = 0, i = 0, j = 0,
	ans = 0, num = 0, sum = 0, mo = 0, me = 0, cnt = 0, mi = inf, ma = 0;
	id = 0, id1 = 0, id2 = 0;
	x = 0, y = 0, z = 0; l = 0, r = 0, q = 0, a = 0, b = 0, c = 0, d = 0;

	cin >> n;
	vi h(n), t(n);
	fr(i, 0, n - 1) cin >> h[i];
	fr(i, 0, n - 1) cin >> t[i];
	id = 1;
	fr(i, 1, n - 1) {
		if (t[i] != t[i - 1]) id = 0;
	}
	if (id) {
		bool now = 0;
		fr(i, 0, n - 1) {
			if (h[i] < t[0]) {
				if (now) ans++;
				else num++;
			}
			else if (h[i] == t[0]) {
				ans += num; num = 0;
				ans++; now = 1;
			}
			else {
				now = 0; num = 0;
			}
		}
		cout << ans; return;
	}

}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	int T = 1;
	// cin >> T;
	while (T--) {
		cout << fixed << setprecision(2); solve();
		cout << endl;
	} return 0;
}
// TULIS !!! / liat sebaliknya / semuanya / sebagian
// out of bounds / overflor / array bounds
// answer minus, edge test case / special tc
// TLE/MLE
// art other approach / solusi jangan terlalu ribet

/*
brute force, greedy,pref sum / xor / factor / prime,2pointer,gcd/lcm,even/odd
,min/max,binsearch, bfs/dfs,iterate,multiple/divisor

DSU, bipartite graph,bitmasking, sliding window,konstanta
divconquer,bitmasking, konstanta,djikstra,stack,queue,scanline
coordinate compression,sparse table,prefix difference,segtree,dp,
*/
// tools :
//__lg(x),__builtinpopcount,nextpermutation(), is_sorted / alpha / digit,
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 596 KB Output is correct
3 Correct 11 ms 1620 KB Output is correct
4 Correct 8 ms 1876 KB Output is correct
5 Correct 17 ms 1876 KB Output is correct
6 Correct 8 ms 1876 KB Output is correct
7 Correct 9 ms 1876 KB Output is correct
8 Correct 17 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -