# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
201915 | stefdasca | Naan (JOI19_naan) | C++14 | 46 ms | 14712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9
// #define fisier 1
using namespace std;
typedef long long ll;
int n, l;
int mat[2002][2002];
ll num[2002][2002], den[2002][2002];
bool tk[2002];
int main()
{
#ifdef fisier
ifstream f("input.in");
ofstream g("output.out");
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> l;
for(int i = 0; i < n; ++i)
for(int j = 0; j < l; ++j)
cin >> mat[i][j];
for(int i = 0; i < n; ++i)
{
int sum = 0;
for(int j = 0; j < l; ++j)
sum += mat[i][j];
int cursum = 0;
int pp = 0;
for(int j = 0; j < n; ++j)
{
while(1LL * cursum * n < 1LL * sum * (j+1))
cursum += mat[i][pp++];
num[i][j] = 1LL * pp * n * mat[i][pp - 1] - cursum * n + sum * (j+1);
den[i][j] = n * mat[i][pp - 1];
}
}
vector<int> wh;
for(int i = 0; i < n; ++i)
{
int cn = -1;
for(int j = 0; j < n; ++j)
if(!tk[j])
{
if(cn == -1 || ((0.0000 + num[cn][i]) / (0.0000 + den[cn][i]) > (0.0000 + num[j][i]) / (0.0000 + den[j][i])))
cn = j;
}
wh.pb(cn);
tk[cn] = 1;
}
for(int i = 0; i + 1 < wh.size(); ++i)
cout << num[wh[i]][i] << " " << den[wh[i]][i] << '\n';
for(int i = 0; i < wh.size(); ++i)
cout << wh[i] + 1 << " ";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |