# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
684584 |
2023-01-21T21:20:19 Z |
koolaider |
Med (COCI22_med) |
C++17 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define pb push_back
#define ll long long
const long long MN = 2e9;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//func(Zeal){Try to make things logical for you, be less pressured}
// Draw cases
// Try to find the pattern
// chill confidence
/*
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("Ofast")
*/
//const long long ML = 1e18;
//const int MN = 1e9;
const int MM = 1e9+7;
int main(int argc, char **argv){
//ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
//setIO("feast");
int n; cin >> n;
string s; int a, b, c, d, e;
vector<string> v;
vector<pair<int, string>> vp;
for(int i = 0; i<n; i++){
cin >> s;
cin >> a >> b >> c >> d >> e;
int sum = a+b+c+d+e;
v.pb(s);
vp.pb({sum, s});
}
for(int i = 0; i<n; i++){
vector<pair<int, string>> tempura=vp;
string name = tempura[i].second;
tempura[i].first+=500;
for(int j = 0; j<n; j++){
if(j!=i){
tempura[j].first-=0;
}
}
sort(tempura.begin(), tempura.end());
int best;
for(int j = 0; j<n; j++){
if(tempura[j].second==name){
best=n-j;
for(int k = 0; k<j; k++){
if(tempura[j].first==best){
best=n-k; break;
}
}
break;
}
}
cout << best << " ";
vector<pair<int, string>> tempura2=vp;
name = tempura2[i].second;
tempura2[i].first-=0;
for(int j = 0; j<n; j++){
if(j!=i){
tempura2[j].first+=500;
}
}
sort(tempura2.begin(), tempura2.end());
for(int j = 0; j<n; j++){
if(tempura2[j].second==name){
best=n-j;
for(int k = 0; k<j; k++){
if(tempura2[j].first==best){
best=n-k; break;
}
}
break;
}
}
cout << best << endl;
}
return 0;
}
Compilation message
Main.cpp: In function 'void setIO(std::string)':
Main.cpp:6:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
6 | freopen((s + ".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
7 | freopen((s + ".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main(int, char**)':
Main.cpp:98:19: warning: 'best' may be used uninitialized in this function [-Wmaybe-uninitialized]
98 | cout << best << " ";
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |