This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define lb lower_bound
#define gibon ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long long ll;
using namespace std;
const int mxN=605;
const int mxM=1557;
const int mxK=60;
const ll MOD=1'000'000'007;
const ll inv2=500'000'004;
const ll INF=1e16;
int N, M;
int ans;
int cnt[mxN][mxN];
void input(){
cin >> N >> M;
for(int i=1;i<=M;i++){
int a, b, c;
cin >> a >> b >> c;
if(a>b) swap(a, b);
for(int j=1;j<=N;j++) for(int k=1;k<=N;k++){
int p1=(a<=j && j<b), p2=(a<=k && k<b);
if(p1+p2!=1) continue;
cnt[j][k]++;
}
}
//for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) printf("cnt[%d][%d]=%d\n", i, j, cnt[i][j]);
for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) ans=max(ans, (cnt[i][j]+1)/2);
cout << ans;
}
int main(){
gibon
input();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |