Submission #540600

#TimeUsernameProblemLanguageResultExecution timeMemory
540600Killer2501Sob (COCI19_sob)C++14
110 / 110
82 ms7244 KiB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fi first
#define se second
using namespace std;
const int N = 2e5+5;
const int M = 1e5+5;
const int mod = 1e9+7;
const ll base = 75;
const int inf = 1e9+7;
int a[N], b[N], dp[N][3];
int n, m, q;
ll ans;
void sol()
{
    cin >> n >> m;
    int lst = 0;
    for(int i = n-1; i >= 0; )
    {
        for(int j = lst; j < n; j ++)
        {
            if(((i&(j+m)) == i))
            {
                int l = lst;
                lst = j+1;
                while(i >= 0 && j >= l && ((i&(j+m)) == i))
                {
                    cout << i <<" "<<j+m<<'\n';
                    --i;
                    --j;
                }
                break;
            }
        }
    }
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    #define task "test"
    if(fopen(task".inp", "r"))
	{
		freopen(task".inp", "r", stdin);
		freopen(task".out", "w", stdout);
	}
    int test = 1;
    //cin >> test;
    while(test -- > 0)sol();
    return 0;
}


Compilation message (stderr)

sob.cpp: In function 'int main()':
sob.cpp:50:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sob.cpp:51:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...