Submission #535252

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5352522022-03-09 18:49:26shayanebrahimiNaan (JOI19_naan)C++14
100 / 100
852 ms130896 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define fast_io; ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll MOD=1e9+7;//998244353//1e9+9;
//ll tavmd(ll a,ll b){if(b==0){return 1;}if(b%2==0){ll x=tavmd(a,b/2);return(x*x)%MOD;}else{return(a%MOD*tavmd(a,b-1)%MOD)%MOD;}}
const ll MAXN=2e3+10;
const ll INF=8e18;
const ll LOG=30;
ll a[MAXN][MAXN],n,k,p[MAXN];
pair<ll,ll>ans[MAXN];
bool chc[MAXN];
int main(){
fast_io;
cin>>n>>k;
for(int i=0;i<n;i++)
for(int j=0;j<k;j++)
cin>>a[i][j];
vector<pair<ll,pair<ll,ll>>>ls[n-1];
for(int i=0;i<n;i++){
ll s=0;
for(int j=0;j<k;j++)
s+=a[i][j];
ll pt=0,pf=0;
for(int j=0;j<n-1;j++){
while(pt<k&&(pf+a[i][pt])*n<=s*(j+1))
pf+=a[i][pt++];
ls[j].push_back({i,{s*(j+1)-pf*n+pt*a[i][pt]*n,a[i][pt]*n}});
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

naan.cpp:5:9: warning: ISO C++11 requires whitespace after the macro name
    5 | #define fast_io;                 ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
      |         ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...