Submission #285784

# Submission time Handle Problem Language Result Execution time Memory
285784 2020-08-29T15:17:31 Z limabeans Election Campaign (JOI15_election_campaign) C++17
5 / 100
58 ms 6004 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e5 + 5;



int n, x[maxn], y[maxn];
int m;
int a[maxn], b[maxn], c[maxn];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    cin>>n;
    for (int i=0; i<n-1; i++) {
	cin>>x[i]>>y[i];
	assert(x[i]==i+1);
	assert(y[i]==i+1+1);
    }

    cin>>m;
    for (int i=0; i<m; i++) {
	cin>>a[i]>>b[i]>>c[i];
	if (a[i]>b[i]) swap(a[i],b[i]);
    }

    // assume subtask 2
    vector<pair<int,int>> v;
    for (int i=0; i<m; i++) {
	v.push_back({b[i],a[i]});
    }

    int hi = -1;
    int res = 0;
    sort(v.begin(),v.end());

    for (auto p: v) {
	int l = p.second;
	int r = p.first;
	if (l>hi) {
	    res++;
	    //cout<<l<<","<<r<<endl;
	    hi = max(hi, r);
	}
    }


    cout<<res<<endl;    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 55 ms 5876 KB Output is correct
5 Correct 56 ms 5876 KB Output is correct
6 Correct 54 ms 6004 KB Output is correct
7 Correct 54 ms 5876 KB Output is correct
8 Correct 55 ms 5868 KB Output is correct
9 Correct 56 ms 5876 KB Output is correct
10 Correct 58 ms 5876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 55 ms 5876 KB Output is correct
5 Correct 56 ms 5876 KB Output is correct
6 Correct 54 ms 6004 KB Output is correct
7 Correct 54 ms 5876 KB Output is correct
8 Correct 55 ms 5868 KB Output is correct
9 Correct 56 ms 5876 KB Output is correct
10 Correct 58 ms 5876 KB Output is correct
11 Incorrect 13 ms 1280 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 544 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -