编程介的小学生 2019-01-02 23:45 采纳率: 20.5%
浏览 472
已采纳

求问各位大咖专家,这里的这个算法问题使用什么算法,暴力搜索速度太慢,C语言

Problem Description
In the year of 2045,the soccer championship is gradually replaced by Earth Super Soccer Cup(We will call it EarthCup for short later).

For one EarthCup,there are n(n≤50000) soccer teams participated in. Every two teams will have a game. It means that every team will have n−1 games with all the other teams.

In order to make the result clear, it is ruled that if the two teams of a game have the same score when the game ends.Penalty shootout will last until there is a result.

In the EarthCup,every team has a Mark,and will score one point after winning a game and zero after losing a game. The team with the highest mark will be the champion.

In the year of 2333, somebody found that some teams had hired hackers to attack and modified the data of the EarthCup for many years.Maybe because of the great amount of the teams, this serious cheating behavior has not been found during hundreds of years.

To check whether the data was modified, they started to check the "Mark Table" in the past.

But because of the long ages, there were only the final Mark of each team reserved. No one remember the exact result of each game.Now they want to find out some "Mark Table" that must have been modified.

"Must have been modified" means we can not get this "Mark Table" by any exact result of each game according to the rules was given by.

Input
There is an positive integer T(T≤50) standing for the number of testcases.

For each testcase, there is an positive integer n standing for the number of teams participate in EarthCup.

The followed n lines describe the "Mark table". The ith integer ai(0≤ai<n) standing for the final Mark of the ith team.

Hint:
For the first testcase:
One possible way is:
Team1 won Team2 and Team3,gained 2 marks.Team2 won Team3 but lost the game with Team1,gained 1 mark.Team3 lost both games and gained 0.

For the second testcase:
It's obviously impossible that all the teams would win all the games.So it must have been modified.
The Input ai is disordered.

Output
For each testcase, output "The data have been tampered with!"(without quotation) if it must have been modified,otherwise output "It seems to have no problem."(without quotation).

Sample Input
2
3
2
1
0
3
2
2
2

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 有偿求码,CNN+LSTM实现单通道脑电信号EEG的睡眠分期评估
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路