Submission #82600

# Submission time Handle Problem Language Result Execution time Memory
82600 2018-10-31T14:59:34 Z thiago4532 Usmjeri (COCI17_usmjeri) C++17
0 / 140
173 ms 5336 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define int long long
using namespace std;
typedef pair<int, int> pii;
const int maxn = 3e5 + 10;
int n, m;
pii v_[maxn], v[maxn];
bool mark[maxn];


int32_t main(){
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	for(int i=1;i<n;i++){
		int a, b;
		cin >> a >> b;
	}		
	for(int i=1;i<=m;i++)
		cin >> v_[i].ff >> v_[i].ss;

	sort(v_+1, v_+m+1);
	
	int k=1;
	v[k] = v_[k];

	for(int i=2;i<=m;i++){
		if(v[i].ff <= v[k].ss && v_[i].ss <= v[k].ss) continue;
		else if(v[i].ff <= v[k].ss) v[k].ss = v_[i].ss;
		else v[++k] = v_[i];
	}
	m = k;

	int ans=(n-1-m)*2*m;
	cout << ans << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 3448 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 140 ms 5108 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 5108 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 5152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 5228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 5244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 5336 KB Output isn't correct
2 Halted 0 ms 0 KB -