# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
633401 |
2022-08-22T10:43:37 Z |
Ferid20072020 |
Med (COCI22_med) |
C++14 |
|
142 ms |
400 KB |
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using namespace chrono;
//using namespace atcoder
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vd vector<double>
#define vld vector<long double>
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define f first
#define s second
#define pii pair<int , int>
#define pll pair<ll , ll>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define psi pair<string , int>
#define pci pair<char , int>
#define pic pair<int , char>
#define pis pair<int , string>
#define psl pair<string , ll>
#define pcl pair<char , ll>
#define plc pair<ll , char>
#define pls pair<ll , string>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ins insert
#define END return 0
#define mod 1e9
#define speed ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define all(x) (x).begin() , (x).end()
#define oo 1e9
#define Size(x) x.size()
/*
int gcd(int number1 , int number2){
if(number2 == 0){
return number1;
}
return gcd(number2 , number1 % number2);
}
int lcm(int number1 , int number2){
return number1 / gcd(number1 , number2) * number2;
}
ll fact(int number){
ll product = 1;
for(int i=2 ; i<=number ; i++){
product *= i;
}
return product;
}
*/
//#define int ll
bool comp(pis A , pis B){
if(A.f > B.f){
return true;
}
else if(A.f == B.f){
if(A.s < B.s){
return true;
}
return false;
}
else{
return false;
}
}
void solve(){
int test;
cin >> test;
vector<psi> Input;
for(int i=0 ; i<test ; i++){
string s;
int p1 , p2 , p3 , p4 , p5;
cin >> s >> p1 >> p2 >> p3 >> p4 >> p5;
Input.pb({s , (p1 + p2 + p3 + p4 + p5)});
}
for(int i=0 ; i<test ; i++){
vector<pis> ranks_high , ranks_low;
for(int j=0 ; j<Input.size() ; j++){
if(j != i){
ranks_high.pb({Input[j].s , Input[j].f});
}
}
ranks_high.pb({Input[i].s + 500 , Input[i].f});
sort(all(ranks_high) , comp);
for(int k=0 ; k<ranks_high.size() ; k++){
if(ranks_high[k].s == Input[i].f){
cout << k + 1 << " ";
}
}
for(int j=0 ; j<Input.size() ; j++){
if(j != i){
ranks_low.pb({Input[j].s + 500 , Input[j].f});
}
}
ranks_low.pb({Input[i].s , Input[i].f});
sort(all(ranks_low) , comp);
for(int k=0 ; k<ranks_low.size() ; k++){
if(ranks_low[k].s == Input[i].f){
cout << k + 1 << '\n';
}
}
}
}
/*signed */ int main(){
speed;
int t = 1;
//cin >> t;
while(t--){
solve();
}
END;
}
Compilation message
Main.cpp: In function 'void solve()':
Main.cpp:105:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
105 | for(int j=0 ; j<Input.size() ; j++){
| ~^~~~~~~~~~~~~
Main.cpp:112:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
112 | for(int k=0 ; k<ranks_high.size() ; k++){
| ~^~~~~~~~~~~~~~~~~~
Main.cpp:118:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
118 | for(int j=0 ; j<Input.size() ; j++){
| ~^~~~~~~~~~~~~
Main.cpp:125:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
125 | for(int k=0 ; k<ranks_low.size() ; k++){
| ~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
62 ms |
380 KB |
Output is correct |
6 |
Correct |
136 ms |
396 KB |
Output is correct |
7 |
Correct |
79 ms |
376 KB |
Output is correct |
8 |
Correct |
142 ms |
400 KB |
Output is correct |
9 |
Correct |
80 ms |
348 KB |
Output is correct |