# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
383192 |
2021-03-29T07:28:07 Z |
ogibogi2004 |
Naan (JOI19_naan) |
C++14 |
|
4 ms |
512 KB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,l;
ll v[2048][2048];
pair<ll,ll> p[2048][2048];
bool cmp(pair<ll,ll> p1,pair<ll,ll> p2)
{
return p1.first*p2.second<p1.second*p2.first;
}
bool used[2048];
int main()
{
cin>>n>>l;
for(ll i=1;i<=n;++i)
{
for(ll j=1;j<=l;++j)
{
cin>>v[i][j];
}
}
for(ll i=1;i<=n;++i)
{
ll sum=0;
for(ll j=1;j<=l;++j)
{
sum+=v[i][j];
}
ll sumv=0,needed;
ll r=1;
for(ll j=1;j<n;++j)
{
needed=sum*j;
while(sumv+v[i][r]*n<=needed)
{
sumv+=v[i][r]*n;
++r;
}
p[i][j]={(ll)(r-1)*v[i][r]*n+needed-sumv,(ll)n*v[i][r]};
}
}
vector<ll>ans;
for(ll i=1;i<n;++i)
{
bool found=0;
pair<ll,ll> best;
ll idx;
for(ll j=1;j<=n;++j)
{
if(used[j])continue;
if(!found||cmp(p[i][j],best))
{
best=p[i][j];found=1;
idx=j;
}
}
cout<<p[i][idx].first<<" "<<p[i][idx].second<<'\n';
used[idx]=1;
ans.push_back(idx);
}
for(ll i=1;i<=n;++i)if(!used[i])ans.push_back(i);
for(auto xd:ans)
{
cout<<xd<<" ";
}
cout<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not a fair distribution. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
3 |
Correct |
2 ms |
492 KB |
Output is correct |
4 |
Correct |
3 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
492 KB |
Output is correct |
6 |
Correct |
2 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
2 ms |
364 KB |
Output is correct |
9 |
Correct |
3 ms |
492 KB |
Output is correct |
10 |
Correct |
3 ms |
492 KB |
Output is correct |
11 |
Correct |
2 ms |
492 KB |
Output is correct |
12 |
Correct |
1 ms |
364 KB |
Output is correct |
13 |
Correct |
2 ms |
364 KB |
Output is correct |
14 |
Correct |
3 ms |
492 KB |
Output is correct |
15 |
Correct |
2 ms |
492 KB |
Output is correct |
16 |
Correct |
3 ms |
512 KB |
Output is correct |
17 |
Correct |
3 ms |
492 KB |
Output is correct |
18 |
Correct |
3 ms |
492 KB |
Output is correct |
19 |
Correct |
4 ms |
492 KB |
Output is correct |
20 |
Correct |
3 ms |
492 KB |
Output is correct |
21 |
Correct |
3 ms |
492 KB |
Output is correct |
22 |
Correct |
3 ms |
492 KB |
Output is correct |
23 |
Incorrect |
1 ms |
364 KB |
Not a fair distribution. |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not a fair distribution. |
2 |
Halted |
0 ms |
0 KB |
- |