# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
863812 |
2023-10-21T07:31:26 Z |
AtabayRajabli |
Poi (IOI09_poi) |
C++17 |
|
168 ms |
39516 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// author : AtabeyR
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
#define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sec second
#define fi first
#define int ll
#define print(k) cerr << "Ans : "; cout << k << endl;
#define ins insert
#define bpc __builtin_popcountll
#define skip continue
#define endll '\n'
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a*b / (__gcd(a, b))
typedef long long ll;
typedef unsigned long long ull;
const int oo = 0x3F3F3F3F;
const int ooo = 0x3F3F3F3F3F3F3F3FLL;
const int mod = 998244353;
const int sz = 2005;
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
void open(string s)
{
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
int n, m, t, p, a[sz][sz], s[sz];
bool cmp(pii a, pii b)
{
if(a.fi == b.fi)return a.sec < b.sec;
return a.fi > b.fi;
}
void solve()
{
cin >> n >> t >> p;
for(int i = 1; i<=n; i++)
{
for(int j = 1; j<=t; j++)
{
cin >> a[i][j];
s[j] += (a[i][j] == 0);
}
}
vector<pii> v;
for(int i = 1; i<=n; i++)
{
int po = 0;
for(int j = 1; j<=n; j++)po += s[j] * a[i][j];
v.pb({po, i});
}
sort(all(v), cmp);
int r = 1;
for(pii x : v)
{
if(x.sec == p)
{
cout << x.fi << " " << r << endll;
return;
}
else r++;
}
}
int32_t main()
{
// open("i");
OPT
int t = 1;
//cin >> t;
for(int i = 1; i<=t; i++)
solve();
}
Compilation message
poi.cpp: In function 'void open(std::string)':
poi.cpp:35:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
35 | freopen((s + ".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:36:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | freopen((s + ".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
2536 KB |
Output isn't correct |
10 |
Correct |
2 ms |
4444 KB |
Output is correct |
11 |
Incorrect |
6 ms |
6924 KB |
Output isn't correct |
12 |
Correct |
9 ms |
9052 KB |
Output is correct |
13 |
Incorrect |
26 ms |
13880 KB |
Output isn't correct |
14 |
Correct |
37 ms |
18488 KB |
Output is correct |
15 |
Incorrect |
77 ms |
24016 KB |
Output isn't correct |
16 |
Correct |
72 ms |
24260 KB |
Output is correct |
17 |
Incorrect |
101 ms |
29780 KB |
Output isn't correct |
18 |
Correct |
122 ms |
32740 KB |
Output is correct |
19 |
Correct |
153 ms |
38736 KB |
Output is correct |
20 |
Correct |
168 ms |
39516 KB |
Output is correct |