Submission #115911

#TimeUsernameProblemLanguageResultExecution timeMemory
115911shayan_pArranging Tickets (JOI17_arranging_tickets)C++14
0 / 100
3 ms384 KiB
// 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 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...