| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 465939 | yanire | Poi (IOI09_poi) | C++11 | 334 ms | 39492 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
//@formatter:off
#ifdef lol
const bool dbg = true;
#else
const bool dbg = false;
#endif
#define dout if(dbg) cout
#define fin(i, s, n) for (auto i = s; i < n; ++i)
#define fine(i, s, n) for (auto i = s; i <= n; ++i)
#define int int64_t
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define def(x) int x; cin >> x
#define cases def(t); while (t--)
#define cases1 int t = 1; while(t--)
#define all(x) (x).begin(), (x).end()
#define chkmax(a,b) a = max(a,b)
#define chkmin(a,b) a = min(a,b)
using ii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vii = vector<ii>;
using vvii = vector<vector<ii>>;
using ld = long double;
//using bigint = __int128;
#define tct template<class T>
#define tcab template<class A, class B>
tcab ostream &operator<<(ostream &os, pair<A, B> p) { return os << '{' << p.x << ',' << p.y << '}'; }
tct ostream &operator<<(ostream &os, vector<T> v) { os << '['; if (!v.empty()) { os << v[0]; fin(i, 1, v.size()) os << ',' << v[i]; } return os << ']'; }
tcab istream& operator>>(istream& is, pair<A,B>& p) { return is >> p.x >> p.y; }
tct istream& operator>>(istream& is, vector<T>& v) { for(auto& x : v) is >> x; return is; }
#define popcnt(x) __builtin_popcount(x)
//#define sz(x) int(x.size())
int rnd() { return rand()^(rand()<<15); }
int gcd(int a, int b) { return b?gcd(b,a%b):a;}
//@formatter:on
const int maxn = 2005;
int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    int n,t,p;
    cin >> n >> t >> p;
    vvi a(n,vi(t,0));
    vi cnt(n,0),value(t,n),score(n,0);
    fin(i,0,n) fin(j,0,t) {
        cin >> a[i][j];
        cnt[i] += a[i][j];
        value[j] -= a[i][j];
    }
    fin(i,0,n) fin(j,0,t) score[i] += a[i][j]*value[j];
    vi ans(n);
    iota(all(ans),0);
    sort(all(ans),[&](int i, int j) {
        if(score[i]!=score[j]) return score[i] > score[j];
        if(cnt[i]!=cnt[j]) return cnt[i] > cnt[j];
        return i < j;
    });
    --p;
    cout << score[p] << ' ';
    fin(i,0,n) if(ans[i]==p) cout << i+1 << endl;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
