# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
316787 | 2020-10-28T02:17:35 Z | Tahmid690 | Arranging Shoes (IOI19_shoes) | C++14 | 32 ms | 1916 KB |
#include<bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector<int> ara){ int flag=0; for(int i=1;i<ara.size();i++) if(abs(ara[i])!=abs(ara[i-1])) flag=1; if(flag==0){ long long ans=0; long long m; m=ara.size()/2; for(int i=0;i<ara.size();i++){ if(ara[i]<0){ if(i%2==0) ans++; } } return m-ans; } long long n; n=ara.size(); n/=2; if(n==1){ if(ara[0]<0) return 0; else return 1; } return (n*(n-1))/2; } /*int main(){ int n; cin >> n; vector<int> vct; while(n--){ int x; cin >> x; vct.push_back(x); } cout << count_swaps(vct) << endl; }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 0 ms | 256 KB | Output is correct |
9 | Incorrect | 0 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Correct | 32 ms | 1912 KB | Output is correct |
6 | Correct | 32 ms | 1912 KB | Output is correct |
7 | Correct | 32 ms | 1916 KB | Output is correct |
8 | Correct | 31 ms | 1912 KB | Output is correct |
9 | Correct | 32 ms | 1912 KB | Output is correct |
10 | Correct | 32 ms | 1912 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |