이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// High above the clouds there is a rainbow...
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=100,mod=1e9+7;
const ll inf=1e18;
ll val[maxn][maxn];
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n,m;cin>>n>>m;
for(int i=0;i<m;i++){
int a,b;cin>>a>>b; --a,--b;
ll X;cin>>X;
for(int x=a;x!=b;x= (x+1)%n)
for(int y=b; y!=a; y= (y+1)%n)
val[x][y]+=X, val[y][x]+=X;
}
ll ans=0;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
ans=max(ans, val[i][j]);
return cout<<(ans+1)/2<<endl,0;
}
// Deathly mistakes:
// * Read the problem curfully.
// * Check maxn.
// * Overflows.
# | 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... |