Submission #201915

#TimeUsernameProblemLanguageResultExecution timeMemory
201915stefdascaNaan (JOI19_naan)C++14
29 / 100
46 ms14712 KiB
#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; }

Compilation message (stderr)

naan.cpp: In function 'int main()':
naan.cpp:65:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i + 1 < wh.size(); ++i)
                    ~~~~~~^~~~~~~~~~~
naan.cpp:67:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < wh.size(); ++i)
                    ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...