Submission #965350

#TimeUsernameProblemLanguageResultExecution timeMemory
965350akacool445kArranging Shoes (IOI19_shoes)C++14
45 / 100
18 ms3272 KiB
#include "shoes.h"

long long count_swaps(std::vector<int> s) {
	long long ans = 0;
	int a = 0, b = 0; 
	for(int x : s) {
		if(x < 0) {
			if(b > 0) {
				ans += b;
				b--;
			} else {
				a++;
			}
		} else {
			if(a > 0) {
				a--;
				ans += a;
			} else {
				b++;
			}
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...