답안 #29375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
29375 2017-07-19T07:50:13 Z Namnamseo Palembang Bridges (APIO15_bridge) C++14
0 / 100
0 ms 2020 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int k, n;
vector<pp> d;
ll ans_base;

void in(){
	read(k, n);
	for(int i=1; i<=n; ++i){
		char p, q;
		int s, t;
		auto f = [](){char t; do{t=getchar();}while(t!='A'&&t!='B'); return t;};
		p = f(); read(s);
		q = f(); read(t);
		if(p == q){
			ans_base += abs(s - t);
		} else {
			++ans_base;
			d.eb(min(s, t), max(s, t));
		}
	}
	n = d.size();
}

int main()
{
	in();
	printf("%lld\n", ans_base);
	return 0;
}

Compilation message

bridge.cpp: In function 'void read(int&)':
bridge.cpp:6:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void read(int& x){ scanf("%d",&x); }
                                  ^
bridge.cpp: In function 'void read(ll&)':
bridge.cpp:7:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void read(ll& x){ scanf("%lld",&x); }
                                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Incorrect 0 ms 2020 KB Output isn't correct
4 Halted 0 ms 0 KB -