답안 #930361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
930361 2024-02-19T12:55:32 Z pan Arcade (NOI20_arcade) C++17
0 / 100
0 ms 352 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include "bits_stdc++.h"
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define input(x) scanf("%lld", &x);
#define input2(x, y) scanf("%lld%lld", &x, &y);
#define input3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z);
#define input4(x, y, z, a) scanf("%lld%lld%lld%lld", &x, &y, &z, &a);
#define print(x, y) printf("%lld%c", x, y);
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
#define discretize(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
using namespace std;
//using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long ll;
typedef long double ld;
typedef pair<ld, ll> pd;
typedef pair<string, ll> psl;
typedef pair<ll, ll> pi;
typedef pair<ll, pi> pii;
bool compare(pi a, pi b)
{
  if (a.f==b.f) return a.s>b.s;
  return a.f<b.f;
}
int main()
{
	ll n, m;
	input2(n, m);
	vector<ll> t(m), a(m);
	vector<pi> op(m);
	for (ll i=0; i<m; ++i) input(t[i]);
	for (ll i=0; i<m; ++i) input(a[i]);
	for (ll i=0; i<m; ++i) {op[i].f = t[i]+a[i], op[i].s = a[i]-t[i];}
	sort(op.begin(), op.end(), compare);
	vector<ll> lis;
	for (ll i=0; i<n; ++i)
	{
		ll ind = lb(lis.begin(), lis.end(), op[i].s)-lis.begin();
		if (ind==lis.size()) lis.pb(op[i].s);
		else lis[ind] = op[i].s;
	}
	print((ll) lis.size(), '\n');
	return 0;
}

Compilation message

Arcade.cpp: In function 'int main()':
Arcade.cpp:49:10: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   if (ind==lis.size()) lis.pb(op[i].s);
      |       ~~~^~~~~~~~~~~~
Arcade.cpp:12:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input2(x, y) scanf("%lld%lld", &x, &y);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~
Arcade.cpp:38:2: note: in expansion of macro 'input2'
   38 |  input2(n, m);
      |  ^~~~~~
Arcade.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
Arcade.cpp:41:25: note: in expansion of macro 'input'
   41 |  for (ll i=0; i<m; ++i) input(t[i]);
      |                         ^~~~~
Arcade.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
Arcade.cpp:42:25: note: in expansion of macro 'input'
   42 |  for (ll i=0; i<m; ++i) input(a[i]);
      |                         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 352 KB Output isn't correct
2 Halted 0 ms 0 KB -