Submission #540597

# Submission time Handle Problem Language Result Execution time Memory
540597 2022-03-21T06:30:45 Z Killer2501 Sob (COCI19_sob) C++14
0 / 110
1 ms 344 KB
#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], lst[N];
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) == 0)
            {
                while(i >= 0 && (i&(j+m) == i) == 0)
                {
                    cout << i <<" "<<j+m<<'\n';
                    --i;
                    --j;
                }
                lst = j+1;
                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

sob.cpp: In function 'void sol()':
sob.cpp:27:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   27 |             if((i&(j+m) == i) == 0)
      |                   ~~~~~~^~~~
sob.cpp:29:42: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   29 |                 while(i >= 0 && (i&(j+m) == i) == 0)
      |                                    ~~~~~~^~~~
sob.cpp: In function 'int main()':
sob.cpp:49:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
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".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 328 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -