Submission #565273

# Submission time Handle Problem Language Result Execution time Memory
565273 2022-05-20T15:06:57 Z SSRS Election Campaign (JOI15_election_campaign) C++14
5 / 100
163 ms 6664 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<vector<int>> E(N);
  for (int i = 0; i < N - 1; i++){
    int X, Y;
    cin >> X >> Y;
  }
  int M;
  cin >> M;
  vector<int> A(M), B(M);
  for (int i = 0; i < M; i++){
    int C;
    cin >> A[i] >> B[i] >> C;
    if (A[i] > B[i]){
      swap(A[i], B[i]);
    }
    A[i]--;
  }
  vector<pair<int, int>> P(M);
  for (int i = 0; i < M; i++){
    P[i] = make_pair(B[i], A[i]);
  }
  sort(P.begin(), P.end());
  int p = -1;
  int ans = 0;
  for (int i = 0; i < M; i++){
    if (P[i].second >= p){
      p = P[i].first;
      ans++;
    }
  }
  cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 150 ms 6608 KB Output is correct
5 Correct 139 ms 6612 KB Output is correct
6 Correct 127 ms 6664 KB Output is correct
7 Correct 163 ms 6612 KB Output is correct
8 Correct 131 ms 6596 KB Output is correct
9 Correct 126 ms 6600 KB Output is correct
10 Correct 137 ms 6608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 150 ms 6608 KB Output is correct
5 Correct 139 ms 6612 KB Output is correct
6 Correct 127 ms 6664 KB Output is correct
7 Correct 163 ms 6612 KB Output is correct
8 Correct 131 ms 6596 KB Output is correct
9 Correct 126 ms 6600 KB Output is correct
10 Correct 137 ms 6608 KB Output is correct
11 Incorrect 20 ms 1116 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 153 ms 4176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -