# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
387605 |
2021-04-09T03:37:48 Z |
bad_in_physics |
Poi (IOI09_poi) |
C++17 |
|
298 ms |
24316 KB |
// i love pikachu
#include<bits/stdc++.h>
using namespace std;
//data types
#define ll long long int
#define str string
#define db long double
//vector
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define pop pop_back()
//general
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (ll)(x).size()
#define bg(x) (x).begin()
#define ft front()
#define dec() cout << fixed << setprecision(15)
#define dbg(x) cerr << #x << " is " << x << '\n'
#define ins insert
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define atyes cout << "Yes\n"
#define atno cout << "No\n"
//structs
//permanent functions
ll ceil(ll a, ll b) {
if (a%b==0) {
return a/b;
} else {
return a/b + 1;
}
}
void setIO(str s = "") {
ios_base::sync_with_stdio(false);
cin.tie(0);
if (sz(s)) {
freopen((s+".in").c_str(), "r", stdin);
freopen((s+".out").c_str(), "w", stdout);
}
}
//global permanent declarations
vector<ll> dx = {0,1,0,-1,1,1,-1,-1};
vector<ll> dy = {1,0,-1,0,1,-1,1,-1};
//global temp declarations
//temporary functions
//solution
void solve() {
int c , t , id;
cin >> c >> t >> id;
vector<int> map(t);
vector<int> v[c];
vector<tuple<int, int, int>> pts(c);
for (int i=0; i<c; i++) {
for (int j=0; j<t; j++) {
int x;
cin >> x;
v[i].pb(x);
map[j] += (x==0);
}
} for (int i=0; i<c; i++) {
int s = 0 , solved = 0 , p = 0;
for (int j : v[i]) {
s += j*map[p];
solved += j;
p++;
} pts.pb({-s,-solved,i+1});
} sort(all(pts));
for (int i=0; i<c; i++) {
if (get<2>(pts[i]) == id) {
cout << -get<0>(pts[i]) << ' ' << i + 1;
return;
}
}
}
int main(void) {
setIO();
ll t = 1;
//cin>>t;
while (t--) {
solve();
} return 0;
}
Compilation message
poi.cpp: In function 'void setIO(std::string)':
poi.cpp:49:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
49 | freopen((s+".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:50:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
50 | freopen((s+".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
2 ms |
460 KB |
Output is correct |
10 |
Correct |
3 ms |
568 KB |
Output is correct |
11 |
Correct |
10 ms |
1116 KB |
Output is correct |
12 |
Correct |
16 ms |
1740 KB |
Output is correct |
13 |
Correct |
49 ms |
4288 KB |
Output is correct |
14 |
Correct |
65 ms |
5956 KB |
Output is correct |
15 |
Correct |
116 ms |
12868 KB |
Output is correct |
16 |
Correct |
126 ms |
13928 KB |
Output is correct |
17 |
Correct |
185 ms |
17092 KB |
Output is correct |
18 |
Correct |
206 ms |
19364 KB |
Output is correct |
19 |
Correct |
267 ms |
23500 KB |
Output is correct |
20 |
Correct |
298 ms |
24316 KB |
Output is correct |