제출 #126562

#제출 시각아이디문제언어결과실행 시간메모리
126562briansuArranging Tickets (JOI17_arranging_tickets)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; #define REP(i, n) for(int i = 0;i < n;i ++) #define REP1(i, n) for(int i = 1;i <= n;i ++) #define FILL(i, n) memset(i, n, sizeof(i)) #define X first #define Y second #define pb push_back #define SZ(_a) ((int)(_a).size()) #define ALL(_a) (_a).begin(), (_a).end() #ifdef brian #define IOS() template<typename T>void _do(T &&x){cerr<<x<<endl;} template<typename T, typename ...t>void _do(T &&x, t &&...X){cerr<<x<<", ";_do(X...);} #define debug(...) {\ fprintf(stderr, "%s - %d (%s) = ", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\ _do(__VA_ARGS__);\ } #else #define debug(...) #define IOS() ios_base::sync_with_stdio(0);cin.tie(0); #define endl '\n' #endif const ll MAXn = 1e5 + 5; const ll INF = ll(1e18); const ll MOD = 1000000007; ll a[MAXn], b[MAXn], c[MAXn]; map<ii, ll> mp; vector<ii> dt; ll n, m; ll laps(ii x, ll sx, ii y, ll sy) { vector<ii> v1, v2; debug(x.X, x.Y, sx, y.X, y.Y, sy); if(sx)v1.pb(ii(1, x.X)), v1.pb(ii(x.Y, n + 1)); else v1.pb(x); if(sy)v2.pb(ii(1, y.X)), v2.pb(ii(y.Y, n + 1)); else v2.pb(y); for(auto &p:v1)debug(p.X, p.Y); for(auto &q:v2)debug(q.X, q.Y); for(auto &p:v1)for(auto &q:v2)if(!(p.Y <= q.X || q.Y <= p.X))return 1; debug("no"); return 0; } int main(){ IOS(); cin>>n>>m; REP1(i, m)cin>>a[i]>>b[i]>>c[i]; REP1(i, m)if(a[i] > b[i])swap(a[i], b[i]); REP1(i, m)mp[ii(a[i], b[i])]++; ll tmptt = 0; for(auto &p:mp)REP(i, p.Y)dt.pb(p.X); ll mx = 0; for(int i = 1;i <= n;i ++)for(int j = 1;j < i;j ++) { ll ct = 0; for(auto &p:dt)if((i >= p.X && i < p.Y) ^ (j >= p.X && j < p.Y))ct ++; mx = max(mx, ct / 2 + ct % 2); } assert(mx != 0); cout<<mx + tmptt<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...