#include <bits/stdc++.h> #define PB push_back #define MP make_pair #define st first #define nd second #define umap unordered_map #define uset unordered_set #define watch(x) cerr << (#x) << " is " << (x) << endl #define all(a) begin(a),end(a) using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; const int inf=0x3f3f3f3f; const long long llinf=0x3f3f3f3f3f3f3f3f; const double oo=1e15; const double eps=1e-8; const double pi=acos(-1.0); template<typename T> T sqr(T a_) { return a_*a_; } template<typename T> T cub(T a_) { return a_*a_*a_; } // inline void readI(int*n){register char c=0,sign=1;while(c<33)c=getchar_unlocked();if(c=='-'){sign=-1;c=getchar_unlocked();}*n=0;while(c>33){*n*=10;*n+=c-'0';c=getchar_unlocked();}*n*=sign;} // inline void printI(int n){if(!n){putchar_unlocked('0');return;}if(n<0){putchar_unlocked('-');n*=-1;}char digits[12];int i=0;while(n){digits[i++]=(n%10)+'0';n/=10;}while(i--)putchar_unlocked(digits[i]);} // inline void readLL(long long*n){register char c=0,sign=1;while(c<33)c=getchar_unlocked();if(c=='-'){sign=-1;c=getchar_unlocked();}*n=0;while(c>33){*n*=10;*n+=c-'0';c=getchar_unlocked();}*n*=sign;} // inline void printLL(long long n){if(!n){putchar_unlocked('0');return;}if(n<0){putchar_unlocked('-');n*=-1;}char digits[24];int i=0;while(n){digits[i++]=(n%10)+'0';n/=10;}while(i--)putchar_unlocked(digits[i]);} // inline void readS(string*s){register char c=0;while(c<33)c=getchar_unlocked();while(c>=33){*s+=c;c=getchar_unlocked();}} // inline void printS(string s){for(auto c:s)putchar_unlocked(c);} typedef long double ld; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; //-----------------------------------------------// const int N=0; const int M=0; const int mod=1000005997; int t[20][20]; int T,k,n; void dig(int j, int i){ while(t[j][i]>0){ cout<<"=\n"; t[j][i]-=min(10,t[j][i]); } cout<<"=\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>T>>k; while(T--){ cin>>n; for(int i=0; i<n; i++) for(int j=0; j<n; j++) cin>>t[i][j]; cout<<"R FARMER\n"; cout<<"=\n"; for(int j=0; j<20; j+=2){ for(int i=1; i<20; i++){ cout<<"M "<<j<<" "<<i-1<<" "<<j<<" "<<i<<"\n"; cout<<"=\n"; dig(j,i); } cout<<"M "<<j<<" "<<19<<" "<<j+1<<" "<<19<<"\n"; cout<<"=\n"; dig(j+1,19); for(int i=18; i>=0; i--){ cout<<"M "<<j+1<<" "<<i+1<<" "<<j+1<<" "<<i<<"\n"; cout<<"=\n"; dig(j+1,i); } if(j<18){ cout<<"M "<<j+1<<" "<<0<<" "<<j+2<<" "<<0<<"\n"; cout<<"=\n"; dig(j+2,0); } } for(int i=18; i>=0; i--){ cout<<"M "<<i+1<<" "<<0<<" "<<i<<" "<<0<<"\n"; cout<<"=\n"; } cout<<"===\n"; } return 0; } //-----------------------------------------------//
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #include <bits/stdc++.h> #define PB push_back #define MP make_pair #define st first #define nd second #define umap unordered_map #define uset unordered_set #define watch(x) cerr << (#x) << " is " << (x) << endl #define all(a) begin(a),end(a) using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; const int inf=0x3f3f3f3f; const long long llinf=0x3f3f3f3f3f3f3f3f; const double oo=1e15; const double eps=1e-8; const double pi=acos(-1.0); template<typename T> T sqr(T a_) { return a_*a_; } template<typename T> T cub(T a_) { return a_*a_*a_; } // inline void readI(int*n){register char c=0,sign=1;while(c<33)c=getchar_unlocked();if(c=='-'){sign=-1;c=getchar_unlocked();}*n=0;while(c>33){*n*=10;*n+=c-'0';c=getchar_unlocked();}*n*=sign;} // inline void printI(int n){if(!n){putchar_unlocked('0');return;}if(n<0){putchar_unlocked('-');n*=-1;}char digits[12];int i=0;while(n){digits[i++]=(n%10)+'0';n/=10;}while(i--)putchar_unlocked(digits[i]);} // inline void readLL(long long*n){register char c=0,sign=1;while(c<33)c=getchar_unlocked();if(c=='-'){sign=-1;c=getchar_unlocked();}*n=0;while(c>33){*n*=10;*n+=c-'0';c=getchar_unlocked();}*n*=sign;} // inline void printLL(long long n){if(!n){putchar_unlocked('0');return;}if(n<0){putchar_unlocked('-');n*=-1;}char digits[24];int i=0;while(n){digits[i++]=(n%10)+'0';n/=10;}while(i--)putchar_unlocked(digits[i]);} // inline void readS(string*s){register char c=0;while(c<33)c=getchar_unlocked();while(c>=33){*s+=c;c=getchar_unlocked();}} // inline void printS(string s){for(auto c:s)putchar_unlocked(c);} typedef long double ld; typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; //-----------------------------------------------// const int N=0; const int M=0; const int mod=1000005997; int t[20][20]; int T,k,n; void dig(int j, int i){ while(t[j][i]>0){ cout<<"=\n"; t[j][i]-=min(10,t[j][i]); } cout<<"=\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>T>>k; while(T--){ cin>>n; for(int i=0; i<n; i++) for(int j=0; j<n; j++) cin>>t[i][j]; cout<<"R FARMER\n"; cout<<"=\n"; for(int j=0; j<20; j+=2){ for(int i=1; i<20; i++){ cout<<"M "<<j<<" "<<i-1<<" "<<j<<" "<<i<<"\n"; cout<<"=\n"; dig(j,i); } cout<<"M "<<j<<" "<<19<<" "<<j+1<<" "<<19<<"\n"; cout<<"=\n"; dig(j+1,19); for(int i=18; i>=0; i--){ cout<<"M "<<j+1<<" "<<i+1<<" "<<j+1<<" "<<i<<"\n"; cout<<"=\n"; dig(j+1,i); } if(j<18){ cout<<"M "<<j+1<<" "<<0<<" "<<j+2<<" "<<0<<"\n"; cout<<"=\n"; dig(j+2,0); } } for(int i=18; i>=0; i--){ cout<<"M "<<i+1<<" "<<0<<" "<<i<<" "<<0<<"\n"; cout<<"=\n"; } cout<<"===\n"; } return 0; } //-----------------------------------------------// |