QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#644407#7747. Memoryguodong#WA 1ms3656kbC++171.2kb2024-10-16 13:47:032024-10-16 13:47:03

Judging History

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

  • [2024-10-16 13:47:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3656kb
  • [2024-10-16 13:47:03]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long 
using namespace std;
#define For(i,a,b) for(int i = a; i <= b; ++i)
#define push_back emplace_back
#define mp make_pair
class us{
	private:
		vector<int> f;
	public:
		us(int n){
			f.resize(n + 1);
			For(i,1,n) 
				f[i] = i;
		}
		int gf(int x){
			if(x == f[x]) 
				return x;
			return f[x] = gf(f[x]);
		}
		void merge(int a,int b){
			a = gf(a);
			b = gf(b);
			f[b] = a;
		}
};
#define edg pair<int,pair<int,int>>
vector<int> tar,W;
vector<vector<pair<int,int> >> To;
vector<int> ans,siz;
int Dfs(int pos,int fa){
	int cur = 0;
	siz[pos] = tar[pos];
	int v = 0;
	for(auto son : To[pos]){
		if(son.first == fa) continue;
		v = Dfs(son.first,pos);
		siz[pos] += siz[son.first];
		if(v > cur){
			swap(cur,v);
		}
			ans.push_back(v);
	}
	if(fa != -1)
		cur += siz[pos] * (W[fa] - W[pos]);
	return cur;
}
#define eps (1e-10)
signed main(){
#ifdef NICEGUODONG
	freopen("data.in","r",stdin);
#endif
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	long double accm = 0;
	For(i,1,n){
		int a;
		cin >> a;
		accm = a + accm * 0.5;
		if(fabs(accm) <= eps){
			cout << "0";
		}
		else if(accm > 0){
			cout << "+";
		}
		else 
			cout << "-";
	}
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3656kb

input:

10
2 -1 4 -7 4 -8 3 -6 4 -7

output:

+0+-+---+-

result:

ok single line: '+0+-+---+-'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

10
-1 36 18 18 18 18 18 18 18 -18

output:

-++++++++-

result:

ok single line: '-++++++++-'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3628kb

input:

1000
-1 193552 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 967...

output:

-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

result:

wrong answer 1st lines differ - expected: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-', found: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++0'