제출 #800950

#제출 시각아이디문제언어결과실행 시간메모리
800950tlnk07Med (COCI22_med)C++17
50 / 50
2 ms320 KiB
#include<bits/stdc++.h>
using namespace std;

long long n, a[501], x;
string s[501];

int main()
{
	cin >> n;
	for(int i = 1; i <= n; ++i)
	{
		cin >> s[i];
		for(int j = 1; j <= 5; ++j)
		{
			cin >> x;
			a[i] += x;
		}
	}
	for(int i = 1; i <= n; ++i)
	{
		long long cnt1 = 1, cnt2 = 1;
		for(int j = 1; j <= n; ++j)
		{
			if(i != j)
			{
				if(a[i] + 500 == a[j] && s[i] > s[j] || a[i] + 500 < a[j])	++cnt1;
				if(a[i] == a[j] + 500 && s[i] > s[j] || a[i] < a[j] + 500)	++cnt2;
			}
		}
		cout << cnt1 << " " << cnt2 << "\n";
	}
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:26:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   26 |     if(a[i] + 500 == a[j] && s[i] > s[j] || a[i] + 500 < a[j]) ++cnt1;
      |        ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
Main.cpp:27:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   27 |     if(a[i] == a[j] + 500 && s[i] > s[j] || a[i] < a[j] + 500) ++cnt2;
      |        ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...