Submission #1077318

# Submission time Handle Problem Language Result Execution time Memory
1077318 2024-08-27T05:14:43 Z veehj Arranging Tickets (JOI17_arranging_tickets) C++17
10 / 100
107 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()

int main() {
  ll n, m; cin >> n >> m;
  vector<ll> a(m), b(m), c(m); 
  for(ll i=0; i<m; i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
    if(a[i]>b[i]) swap(a[i], b[i]);
  }
  ll ans;
  for(ll i=0; i<(1<<m); i++){
    vector<ll> s(n, 0);
    ll cnt=0;
    for(ll j=0; j<m; j++){
      if(i&(1<<j)){
        s[a[j]]++;
        s[b[j]]--;
      } else {
        s[0]++;
        s[a[j]]--;
        s[b[j]]++;
      }
    }
    ll curr=0;
    for(ll j=0; j<n; j++){
      curr+=s[j];
      cnt=max(curr, cnt);
    }
    if(i==0) ans=cnt;
    else ans=min(ans, cnt);
  }
  cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 92 ms 348 KB Output is correct
2 Correct 91 ms 344 KB Output is correct
3 Correct 92 ms 348 KB Output is correct
4 Correct 107 ms 348 KB Output is correct
5 Correct 93 ms 348 KB Output is correct
6 Correct 91 ms 348 KB Output is correct
7 Correct 91 ms 408 KB Output is correct
8 Correct 99 ms 600 KB Output is correct
9 Correct 92 ms 348 KB Output is correct
10 Correct 97 ms 348 KB Output is correct
11 Correct 96 ms 344 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 95 ms 348 KB Output is correct
14 Correct 91 ms 348 KB Output is correct
15 Correct 96 ms 408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 348 KB Output is correct
2 Correct 91 ms 344 KB Output is correct
3 Correct 92 ms 348 KB Output is correct
4 Correct 107 ms 348 KB Output is correct
5 Correct 93 ms 348 KB Output is correct
6 Correct 91 ms 348 KB Output is correct
7 Correct 91 ms 408 KB Output is correct
8 Correct 99 ms 600 KB Output is correct
9 Correct 92 ms 348 KB Output is correct
10 Correct 97 ms 348 KB Output is correct
11 Correct 96 ms 344 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 95 ms 348 KB Output is correct
14 Correct 91 ms 348 KB Output is correct
15 Correct 96 ms 408 KB Output is correct
16 Incorrect 4 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 348 KB Output is correct
2 Correct 91 ms 344 KB Output is correct
3 Correct 92 ms 348 KB Output is correct
4 Correct 107 ms 348 KB Output is correct
5 Correct 93 ms 348 KB Output is correct
6 Correct 91 ms 348 KB Output is correct
7 Correct 91 ms 408 KB Output is correct
8 Correct 99 ms 600 KB Output is correct
9 Correct 92 ms 348 KB Output is correct
10 Correct 97 ms 348 KB Output is correct
11 Correct 96 ms 344 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 95 ms 348 KB Output is correct
14 Correct 91 ms 348 KB Output is correct
15 Correct 96 ms 408 KB Output is correct
16 Incorrect 4 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 348 KB Output is correct
2 Correct 91 ms 344 KB Output is correct
3 Correct 92 ms 348 KB Output is correct
4 Correct 107 ms 348 KB Output is correct
5 Correct 93 ms 348 KB Output is correct
6 Correct 91 ms 348 KB Output is correct
7 Correct 91 ms 408 KB Output is correct
8 Correct 99 ms 600 KB Output is correct
9 Correct 92 ms 348 KB Output is correct
10 Correct 97 ms 348 KB Output is correct
11 Correct 96 ms 344 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 95 ms 348 KB Output is correct
14 Correct 91 ms 348 KB Output is correct
15 Correct 96 ms 408 KB Output is correct
16 Incorrect 4 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 92 ms 348 KB Output is correct
2 Correct 91 ms 344 KB Output is correct
3 Correct 92 ms 348 KB Output is correct
4 Correct 107 ms 348 KB Output is correct
5 Correct 93 ms 348 KB Output is correct
6 Correct 91 ms 348 KB Output is correct
7 Correct 91 ms 408 KB Output is correct
8 Correct 99 ms 600 KB Output is correct
9 Correct 92 ms 348 KB Output is correct
10 Correct 97 ms 348 KB Output is correct
11 Correct 96 ms 344 KB Output is correct
12 Correct 91 ms 348 KB Output is correct
13 Correct 95 ms 348 KB Output is correct
14 Correct 91 ms 348 KB Output is correct
15 Correct 96 ms 408 KB Output is correct
16 Incorrect 4 ms 348 KB Output isn't correct
17 Halted 0 ms 0 KB -