QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#346560#4774. Please, go firstPetroTarnavskyi#Compile Error//Python3790b2024-03-08 17:50:132024-03-08 17:50:14

Judging History

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

  • [2024-03-08 17:50:14]
  • 评测
  • [2024-03-08 17:50:13]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

void solve()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	map<char, int> last, cnt;
	LL ans = 0;
	FOR(i, 0, n)
	{
		last[s[i]] = i;
		ans -= cnt[s[i]];
		cnt[s[i]]++;
	}
	FOR(i, 0, n)
		ans += last[s[i]] - i;
	cout << 5 * ans << "\n";
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

詳細信息

  File "answer.code", line 3
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax