답안 #776822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
776822 2023-07-08T10:00:50 Z khoquennguoiminhthuong Palembang Bridges (APIO15_bridge) C++14
22 / 100
32 ms 4424 KB
#include <bits/stdc++.h>

using namespace std;
int n,k;
long long ans=0;
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>k>>n;
vector<pair<int,int>>vec;
vector<int>pos;
for(int i=1;i<=n;i++)
{
char a,b;int x,y;
cin>>a>>x>>b>>y;
if(a==b)ans+=abs(x-y);
else {vec.push_back({x,y});pos.push_back(x);pos.push_back(y);}
}
ans+=vec.size();
if(pos.size())
{sort(pos.begin(),pos.end());
int vv=pos.size();
int cc=vv/2;
int vvv=pos[vv/2];
for(auto v:vec)ans+=abs(v.first-vvv)+abs(v.second-vvv);
}
cout<<ans;
    return 0;;
}

Compilation message

bridge.cpp: In function 'int main()':
bridge.cpp:22:5: warning: unused variable 'cc' [-Wunused-variable]
   22 | int cc=vv/2;
      |     ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 16 ms 2844 KB Output is correct
13 Correct 32 ms 4424 KB Output is correct
14 Correct 23 ms 3200 KB Output is correct
15 Correct 19 ms 2740 KB Output is correct
16 Correct 19 ms 3764 KB Output is correct
17 Correct 22 ms 4424 KB Output is correct
18 Correct 27 ms 4028 KB Output is correct
19 Correct 31 ms 4400 KB Output is correct
20 Correct 21 ms 3976 KB Output is correct
21 Correct 27 ms 4136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -