답안 #442763

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
442763 2021-07-09T00:24:27 Z ToniB Sob (COCI19_sob) C++14
110 / 110
127 ms 15144 KB
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <ext/pb_ds/assoc_container.hpp>
#include <bitset>
using namespace std;
using namespace __gnu_pbds;
#define FOR(i, x, n) for(int i = x; i < n; ++i)
#define REP(i, n) for(int i = 0; i < n; ++i)
#define TRACE(x) cerr << #x << " " << x << endl;
#define endl "\n"
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9+7;
const int inf = 2147483647;
const int maxN = 1e6 + 2;
int m, n;

vector<int> x, y;
int p1, p2, plast;
vector<pii> ans;
int main(){
//	ios_base::sync_with_stdio(0);
    cin >> n >> m;
    REP(i, n) x.push_back(i);
    for(int i = m; i < m+n; ++i){
    	y.push_back(i);
	}
	p2 = n-1;
	while(p2 >= 0){
		plast = p1;
		while((y[p1] & x[p2]) != x[p2]){
			p1++;
		}
		for(int i = p1; i >= plast; --i){
			ans.push_back(mp(x[p2], y[i]));
			p2--;
		}
		p1++;
	}
	REP(i, ans.size()){
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	return 0;
}

Compilation message

sob.cpp: In function 'int main()':
sob.cpp:15:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 | #define REP(i, n) for(int i = 0; i < n; ++i)
......
   49 |  REP(i, ans.size()){
      |      ~~~~~~~~~~~~~                  
sob.cpp:49:2: note: in expansion of macro 'REP'
   49 |  REP(i, ans.size()){
      |  ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 68 ms 8072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 392 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 69 ms 8092 KB Output is correct
7 Correct 32 ms 4032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 68 ms 8072 KB Output is correct
5 Correct 1 ms 392 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 288 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 69 ms 8092 KB Output is correct
11 Correct 32 ms 4032 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 1 ms 288 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 14 ms 1996 KB Output is correct
20 Correct 50 ms 6196 KB Output is correct
21 Correct 2 ms 460 KB Output is correct
22 Correct 1 ms 420 KB Output is correct
23 Correct 74 ms 8604 KB Output is correct
24 Correct 126 ms 15144 KB Output is correct
25 Correct 127 ms 14892 KB Output is correct