QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#46091#4330. Točkiceltunjic0 1ms7736kbC++1.2kb2022-08-25 16:50:172022-08-25 16:50:18

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-25 16:50:18]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:7736kb
  • [2022-08-25 16:50:17]
  • 提交

answer

#include <bits/stdc++.h> 

#define ll long long
#define pii pair<ll, ll>
#define X first
#define Y second
#define pb push_back 

using namespace std; 

const int N = 1e6;

int n, pos, stk[N], in[N];
pii point[N];

vector<pair<pii, int>> v;

ll ccw(pii a, pii b, pii c){ 
	return (b.X - a.X) * (c.Y - a.Y) - (c.X - a.X) * (b.Y - a.Y);
}

int main(){ 
	ios_base::sync_with_stdio(false);

	cin >> n;

	for(int i = 0; i < n; i++){ 
		int x, y;
		cin >> x >> y;
		v.pb({{x, y}, i});
		point[i] = {x, y};
	}

	sort(v.begin(), v.end());
	for(pair<pii, int> x : v){ 
		while(pos >= 2){ 
			if(ccw(point[stk[pos - 2]], point[stk[pos - 1]], x.X) > 0)
				pos--;
			else 
				break;
		}
		stk[pos++] = x.Y;
	}
	for(int i = 0; i < pos; i++) in[stk[i]] = true;
	
	pos = 0;
	reverse(v.begin(), v.end());
	for(pair<pii, int> x : v){ 
		while(pos >= 2){ 
			if(ccw(point[stk[pos - 2]], point[stk[pos - 1]], x.X) > 0)
				pos--;
			else
				break;
		}
		stk[pos++] = x.Y;
	}
	for(int i = 0; i < pos; i++) in[stk[i]] = true;
	
	int rub = 0;
	for(int i = 0; i < n; i++) rub += in[i];


	int ans = rub + rub - 3 + (n - rub) * 3;
	cout << (ans & 1 ? "Alenka" : "Bara") << "\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7736kb

input:

1
62 -83

output:

Alenka

result:

wrong answer 1st lines differ - expected: 'Bara', found: 'Alenka'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%