235312026-01-24 12:04:09BalimeWalking In The Parkcpp17Wrong answer 0/100527ms34760 KiB
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ll n,m,k; cin>>n>>m>>k;

	map<ll,ll> ma;

	vector<ll> a(n+1), b(m+1), a2(n+1);
	ll par[200001];
	for(ll i=1; i<=n; i++)
	{
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(ll i=1; i<=m; i++)
	{
		cin>>b[i];
		b[i]+=b[i-1];
		ma.insert({b[i], i});
	}
	for(ll i=1; i<=n; i++)
	{
		a2[i]=ma[a[i]];
	}
	vector<ll> lis;
	for(ll i=1; i<=n; i++)
	{
		auto it =upper_bound(lis.begin(), lis.end(), a2[i]);
		if(it==lis.end())
		{
			lis.push_back(a2[i]);
			if(lis.size()>0)
			{
				par[i]=1;
			}
		}
		else 
		{
			*it=a2[i];
		}
	}
	if(lis.size()<k)
	{
		cout<<-1<<endl; return 0;
	}


}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
2Wrong answer1ms316 KiB
subtask20/19
3Wrong answer319ms34760 KiB
4Wrong answer305ms34520 KiB
5Wrong answer303ms33564 KiB
6Wrong answer303ms33756 KiB
7Wrong answer314ms33756 KiB
8Wrong answer303ms33712 KiB
9Wrong answer300ms31840 KiB
subtask30/23
10Wrong answer1ms332 KiB
11Wrong answer2ms316 KiB
12Wrong answer2ms756 KiB
13Wrong answer2ms316 KiB
14Wrong answer1ms324 KiB
15Wrong answer1ms316 KiB
subtask40/16
16Wrong answer2ms316 KiB
17Wrong answer2ms316 KiB
18Wrong answer2ms316 KiB
19Wrong answer2ms316 KiB
20Wrong answer2ms316 KiB
21Wrong answer2ms316 KiB
22Wrong answer2ms316 KiB
subtask50/42
23Wrong answer524ms28844 KiB
24Wrong answer451ms28772 KiB
25Wrong answer441ms28132 KiB
26Wrong answer517ms28128 KiB
27Wrong answer527ms28076 KiB
28Wrong answer524ms28076 KiB
29Wrong answer398ms27096 KiB