QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#413322#6748. Spin the Wheelgaotianyu#WA 0ms3648kbC++14861b2024-05-17 12:16:502024-05-17 12:16:51

Judging History

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

  • [2024-05-17 12:16:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-05-17 12:16:50]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl "\n"

using namespace std;
typedef pair<int, int> PII;

const int N = 2e5 + 10;
int a[N];

void solve()
{
	int n;
	cin >> n;
	int chazhi = 0;
	bool ok = true;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if (i > 1)
		{
			if (a[i] >= a[i - 1])
			{
				if (!chazhi) chazhi = a[i] - a[i - 1];
				else
				{
					if (chazhi != a[i] - a[i - 1]) ok = false;
				}
			}
			else
			{
				if (!chazhi) chazhi = a[i] + n - a[i - 1];
				else
				{
					if (chazhi != a[i]  + n - a[i - 1]) ok = false;
				}
			}
		}
	}
	if (!ok)
	{
		cout << -1 << endl;
		return ;
	}
	cout << a[2] - a[1];
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int tt = 1;
//	cin>>tt;
	while (tt--) solve();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3648kb

input:

5
1 3 0 2 4

output:

2

result:

wrong answer 1st numbers differ - expected: '3', found: '2'