답안 #660240

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
660240 2022-11-21T09:33:46 Z berr Med (COCI22_med) C++17
50 / 50
1 ms 352 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int cmp(string x, string y)
{

    for(int i=0; i<min(x.size(), y.size()); i++)
    {   cout<<x[i]<<" "<<y[i]<<"\n";
        if(x[i]<y[i]) return 1;
        if(y[i]<x[i]) return 0;
    }
    
    return x.size()<y.size();  
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    

    int n; cin>>n;
    vector<int> tot(n);
    vector<string> s(n);

    for(int i=0; i<n; i++)
    {
        cin>>s[i];
        for(int l=0; l<5; l++)
        {
            int x; cin>>x;
            tot[i]+=x;
        }
    }

    for(int i=0; i<n; i++)
    {
        int r=n, j=n;
        int v=tot[i]+500, z=tot[i]-500;
        for(int l=0; l<n; l++)
        {
            if(i==l) continue;

            if(v>tot[l]||(v==tot[l]&&s[i]<s[l])) r--;
            if(z>tot[l]||(z==tot[l]&&s[i]<s[l])) j--;

        }

        cout<<r<<" "<<j<<"\n";


    }

}

Compilation message

Main.cpp: In function 'long long int cmp(std::string, std::string)':
Main.cpp:8:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'const long unsigned int' [-Wsign-compare]
    8 |     for(int i=0; i<min(x.size(), y.size()); i++)
      |                  ~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 352 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct