QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#311819#5146. SkillsbillyRE 0ms0kbC++171.0kb2024-01-22 20:31:182024-01-22 20:31:19

Judging History

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

  • [2024-01-22 20:31:19]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-01-22 20:31:18]
  • 提交

answer

#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<ctime>
#include<cstdlib>
#include<map>
#define endl "\n"
using ll = long long;
using db = double;
const ll INF = 1e5 + 5;
int a[3][1001];
using namespace std;
void solve()
{
	int n;
	cin >> n;
	for (int i = 0; i <= n - 1; i++)
	{
		for (int j = 0; j <= 2; j++)
		{
			cin >> a[i][j];
		}
	}
	int sum = 0;
	int b[3] = { 0,0,0 };
	for (int i = n - 1; i >= 0; i--)
	{
		int ans=a[i][0]-b[0];
		int cnt = 0;
		for (int j = 1; j <= 2; j++)
		{
			if (a[i][j]-b[j] > ans)
			{
				ans = a[i][j]-b[j];
				cnt = j;
			}
		}
		sum = sum + ans;
		for (int j = 0; j <= 2; j++)
		{
			if (j == cnt)
			{
				b[j] = 0; continue;
			}
			b[j]=2*b[j]+1;
		}
	}
	cout << sum << endl;
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0);
	int t;
	cin >> t;
	while (t--)
	{
		solve();
		cout << '\n';
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Runtime Error

input:

2
3
1 1 10
1 10 1
10 1 1
5
1 2 3
6 5 4
7 8 9
12 11 10
13 14 15

output:


result: