Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* BISMILLAHIR-RAHMANIR-RAHIM
- ____________________________________
- | |
- | SHANTO_SUST_SWE-19_029 |
- |____________________________________|
- */
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
- #define pb push_back
- #define Pi acos(-1.0)
- #define r0 return 0
- #define endl "\n"
- #define show(x) cout << x << endl
- #define take(x) cin >> x
- #define debug 1
- int main()
- {
- int n, m, x, y, k;
- char ch;
- cin >> n >> m >> x >> y;
- int i, j;
- cout << x << " " << y << endl;
- for(i = y + 1; i <= m; i++) {
- cout << x << " " << i << endl;
- }
- for(i = y - 1; i > 0; i--) {
- cout << x << " " << i << endl;
- }
- for(i = 1; i < x; i++) {
- if (i % 2) {
- for(j = 1; j <= m; j++) {
- cout << i << " " << j << endl;
- }
- ch = 'R';
- }
- else {
- for(j = m; j > 0; j--) {
- cout << i << " " << j << endl;
- }
- ch = 'L';
- }
- }
- if(ch == 'R') k = 1;
- else k = 0;
- for(i = x + 1; i <= n; i++) {
- if (k % 2 == 0) {
- for(j = 1; j <= m; j++) {
- cout << i << " " << j << endl;
- }
- k++;
- }
- else {
- for(j = m; j > 0; j--) {
- cout << i << " " << j << endl;
- }
- k++;
- }
- }
- r0;
- }
- //ALHAMDULILLAH
Add Comment
Please, Sign In to add comment