Submission #495869

# Submission time Handle Problem Language Result Execution time Memory
495869 2021-12-20T06:40:53 Z Nimbostratus ACM (COCI19_acm) C++17
0 / 50
25 ms 31992 KB
#include "bits/stdc++.h"
#define endl '\n'
#define fi first
#define se second
constexpr int maxn = 1005;
constexpr int inf = 2e9;
constexpr int mod = 1e9 + 7;
using namespace std;
using lint = long long;
using pii = pair<int, int>;

int n, m;
string sub[maxn][maxn];

struct score {
	int penalty = 0;
	bool ourteam = false;
	string name;
	void add(string& s, int idx) {
		if(s[0] == '-' || s[0] == '?' && ourteam && sub[n + 1][idx][0] != '+') {
			penalty += 20000;
			return;
		}
		string hour = s.substr(3, 4);
		string min = s.substr(6, 7);
		string sec = s.substr(9, 10);
		penalty += stoi(hour) * 3600;
		penalty += stoi(min) * 60;
		penalty += stoi(sec);
		penalty += (s[1] - '0') * 1200;
	}
	friend bool operator<(score& x, score& y) {
		if(x.penalty < y.penalty)
			return true;
		if(x.penalty > y.penalty)
			return false;
		return x.name < y.name;
	}
};

score a[maxn];

signed main() {
	#ifdef Local
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m;
	for(int i = 1; i <= n; i++) {
		cin >> a[i].name;
		a[i].ourteam = a[i].name == "NijeZivotJedanACM";
		for(int j = 1; j <= m; j++)
			cin >> sub[i][j];
	}
	string tmp;
	cin >> tmp;
	for(int i = 1; i <= m; i++)
		cin >> sub[n + 1][i];
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			a[i].add(sub[i][j], j);
	sort(a + 1, a + n + 1);
	for(int i = 1; i <= n; i++)
		if(a[i].ourteam) {
			cout << i << endl;
			return 0;
		}
}

Compilation message

acm.cpp: In member function 'void score::add(std::string&, int)':
acm.cpp:20:44: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   20 |   if(s[0] == '-' || s[0] == '?' && ourteam && sub[n + 1][idx][0] != '+') {
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 31948 KB Output isn't correct
2 Incorrect 23 ms 31948 KB Output isn't correct
3 Incorrect 18 ms 31964 KB Output isn't correct
4 Incorrect 25 ms 31992 KB Output isn't correct
5 Incorrect 19 ms 31972 KB Output isn't correct