Submission #1027201

# Submission time Handle Problem Language Result Execution time Memory
1027201 2024-07-19T01:58:27 Z pdao One-Way Streets (CEOI17_oneway) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int, int>

using namespace std;

signed main() {
  int n, m, p;
  cin >> n >> m;
  vector<vector<pii>> adj(n + 1, vector<pii>(0));
  vector<pii> changes (0);

  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].pb({v, i});
    adj[v].pb({u, i});
  }

  cin >> p;
  for (int i = 0; i < p; i++) {
    int l, r;
    cin >> l >> r;
    changes.pb({l, r});
  }

  char str[m];
  for (int i = 0; i < m; i++) str[i] = 'c';
  for (int i = 0; i < p; i++) {
    int start = changes[i].fi;
    int end = changes[i].se;
    if (adj[start].size() == 1) { // R
      int ind = adj[start][0].se - 1;
      cout << ind << endl;
      if (str[ind] == 'c') str[ind] = 'R';
      else if (str[ind] == 'L') str[ind] = 'B';
    }

    if (adj[end].size() == 1) { // L
      int ind = adj[end][0].se - 1;
      cout << ind << endl;
      if (str[ind] == 'c') str[ind] = 'L';
      else if (str[ind] == 'R') str[ind] = 'B';
    }
  }

  for (char c : str) {
    if (c == 'c') cout << 'B';
    else cout << c;
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -