11360 - Have Fun with Matrices

All about problems in Volume 113. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

setu
New poster
Posts: 4
Joined: Fri Mar 06, 2009 11:33 pm

Re: 11360 - Have Fun with Matrices

Post by setu » Wed Apr 22, 2009 8:56 am

Obaida wrote:Some 1 plz help!!! :(
Hello boss plz read the problem carefully..
u have done mistakes in inc() and dec() function.
U have skiped the mod 10.
And afterall try to use gets and sscanf() as suggested by MRH.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 11360 - Have Fun with Matrices

Post by Obaida » Wed Apr 22, 2009 9:11 am

Thank you all. :)
I got it acc before. but forgot to remove my post. :oops:
try_try_try_try_&&&_try@try.com
This may be the address of success.

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11360 - Have Fun with Matrices

Post by saiful_sust » Mon Jun 01, 2009 9:26 pm

hello obida

If u got ACC then PLZ remove ur code :)

calicratis19
Learning poster
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Location: SUST,SYLHET,BANGLADESH.
Contact:

11360 - Have Fun with Matrices

Post by calicratis19 » Tue Aug 25, 2009 5:58 pm

AC
Last edited by calicratis19 on Thu Sep 10, 2009 12:12 pm, edited 1 time in total.
Heal The World

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 11360 - Have Fun with Matrices

Post by lnr » Wed Sep 09, 2009 8:43 am

Accepted.

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 11360 - Have Fun with Matrices

Post by lnr » Wed Sep 09, 2009 9:05 am

calicratis19 wrote:pls tell me why wa. its making me crazy :( :( :(

Code: Select all

#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 55
int test,dim,i,j,st,end,query,store,mat[SIZE][SIZE],option[SIZE][SIZE],cse;
char str[SIZE],ch;
int main()
{
  //  freopen("in.txt","r",stdin);
    scanf("%d",&test);
    while(test--)
    {
        scanf("%d",&dim);
        for(i=1;i<=dim;i++)
            for(j=1;j<=dim;j++)
            {
                scanf(" %c",&ch);
                if(isdigit(ch)) option[i][j]=mat[i][j]=ch-48;
                else j--;
            }
        scanf("%d",&query);
        while(query--)
        {
            scanf("%s",&str);
            if(strcmp(str,"row")==0)
            {
                scanf("%d %d",&st,&end);

                for(i=1;i<=dim;i++)
                {
                    store=mat[st][i];
                    mat[st][i]=mat[end][i];
                    mat[end][i]=store;
                }
            }
            else if(strcmp(str,"col")==0)
            {
                scanf("%d %d",&st,&end);
                for(i=1;i<=dim;i++)
                {
                    store=mat[i][st];
                    mat[i][st]=mat[i][end];
                    mat[i][end]=store;
                }
            }
            else if(strcmp(str,"inc")==0)
            {
                for(i=1;i<=dim;i++)
                    for(j=1;j<=dim;j++)
                    {
                        mat[i][j]++;
                        if(mat[i][j]==10)mat[i][j]=0;
                    }
            }
            else if(strcmp(str,"dec")==0)
            {
                for(i=1;i<=dim;i++)
                    for(j=1;j<=dim;j++)
                    {
                        mat[i][j]--;
                        if(mat[i][j]==-1)mat[i][j]=9;
                    }
            }
            else if(strcmp(str,"transpose")==0)
            {
                for(i=1;i<=dim;i++)
                    for(j=1;j<=dim;j++)
                        mat[i][j]=option[j][i];
            }
        }
        printf("Case #%d\n",++cse);
        for(i=1;i<=dim;i++)
        {
            for(j=1;j<=dim;j++)
                printf("%d",mat[i][j]);
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}

Taking input:

Code: Select all

		for(i=1;i<=dim;i++){
			for(j=1;j<=dim;j++)
			{
				scanf(" %c",&ch);
				if(ch>='0'&&ch<='9') {					
					mat[i][j]=ch-'0';
				}
				else j--;
			}
		}
Your transpose is not correct.

Code: Select all

			else if(strcmp(str,"transpose")==0)
			{
				for(i=1;i<=dim;i++)
					for(j=1;j<=dim;j++){
						if(i!=j&&i>j){
							int t=mat[i][j];
							mat[i][j]=mat[j][i];
							mat[j][i]=t;								
						}
					}
			}

calicratis19
Learning poster
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Location: SUST,SYLHET,BANGLADESH.
Contact:

Re: 11360 - Have Fun with Matrices

Post by calicratis19 » Thu Sep 10, 2009 11:25 am

thanks lnr :D :D .i have found my bug at last. it was when input will tell me to do transpose twice.then my code will give me wa.

thanks again.but my input taking is good though :wink: :wink:
Heal The World

User avatar
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 11360 - Have Fun with Matrices

Post by plamplam » Mon Jun 27, 2011 11:36 am

My approach is very simple and straightforward. I take the matrix as a n x n string(of course remember to eliminate buffer). Then I copy the contents of the string array(n x n) and paste them in an integer array(n x n). Now this gets very simple. To transpose the matrix, I just simple copy the elements of the first array(in column major order) and paste them in another integer array(in row-major order). Now I copy the elements of the second array and paste them in the first again. I think it is very critical to eliminate keyboard buffer properly. No tricky cases, but remember to print a blank line(even after the last test case as specified in the description).
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

User avatar
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 11360 - Have Fun with Matrices

Post by plamplam » Mon Jun 27, 2011 11:42 am

Ohh...one more thing. I found this thing after experimenting with this problem. You have to take the operations(for example inc, transpose, row a b etc) using scanf("%s");.When I tried with gets() the judge blessed me with a "Wrong Answer" :-?
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

nass
New poster
Posts: 3
Joined: Wed Apr 18, 2012 2:25 pm

11360 - Have Fun with Matrices ( Java Strange Problem )

Post by nass » Wed Apr 18, 2012 2:29 pm

Hi everbody :)
First,sorry for my bad English :)

I have submitted Problem 11360 - Have Fun with Matrices, but i got RuntimeError,on my local PC the sample input works perfect.

So here is my Java Code:

Code: Select all

import java.io.*;
import java.util.*;

public class Main implements Runnable {


    private void solve() throws IOException {


        int T = nextInt();
        
        for(int t = 0; t < T; ++t) {

            int N = nextInt();

            String line = "";
            int[][] matrix = new int[N][N];

            for(int i = 0; i < N; ++i) {
                line = reader.readLine();
                for(int j = 0; j < line.length(); ++j) {
                    matrix[i][j] = line.charAt(j)-'0';
                }
            }
            int M = nextInt();
            String action = "";

            for(int m = 0; m < M; ++m) {

                action = reader.readLine();
                if(action.contains("row")) {

                    int rowA = new Integer(action.split(" ")[1]).intValue();
                    int rowB = new Integer(action.split(" ")[2]).intValue();

                    for(int col = 0; col < matrix.length; ++col) {
                        int temp = matrix[rowA][col];
                        matrix[rowA][col] = matrix[rowB][col];
                        matrix[rowB][col] = temp;
                    }

                } else if(action.contains("col")) {

                    int rowA = new Integer(action.split(" ")[1]).intValue();
                    int rowB = new Integer(action.split(" ")[2]).intValue();

                      for(int row = 0; row < matrix.length; ++row) {
                            int temp = matrix[row][rowA];
                           matrix[rowA][row] = matrix[row][rowB];
                           matrix[row][rowB] = temp;
                      }


                } else if(action.equals("inc")) {

                    for(int r = 0; r < matrix.length; ++r) {
                        for(int c = 0; c < matrix.length; ++c) {
                            matrix[r][c] = (matrix[r][c] + 1)%10;
                        }
                    }

                } else if(action.equals("dec")) {

                    for(int r = 0; r < matrix.length; ++r) {
                        for(int c = 0; c < matrix.length; ++c) {
                            matrix[r][c] = (Math.abs(matrix[r][c] - 1))%10;
                        }
                    }
                    
                } else {

                    int[][] transpose = new int[N][N];
                    for(int r = 0; r < matrix.length; ++r) {
                        for(int c = 0; c < matrix.length; ++c) {
                               transpose[r][c] = matrix[c][r];
                        }
                    }
                    matrix = transpose.clone();

                }


            }

            writer.println("Case #"+(t+1));
            for(int r = 0; r < matrix.length; ++r) {
                for(int c = 0; c < matrix.length; ++c) {
                    writer.print(matrix[r][c]);
                }
                writer.println();
            }
            writer.println();
        }
    
    }

    public static void main(String[] args) {
        new Main().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {

            reader = new BufferedReader(new InputStreamReader(System.in)) ;


            tokenizer = null;
            writer = new PrintWriter(System.out);


            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while(tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }

        return tokenizer.nextToken();
    }
}
And i don't understand why i got RE :(
Thanks in advance :)

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11360 - Have Fun with Matrices ( Java Strange Problem )

Post by brianfry713 » Wed Apr 18, 2012 11:32 pm

http://ideone.com/Ya9Wp

Try it without closing reader and writer.
Check input and AC output for thousands of problems on uDebug!

nass
New poster
Posts: 3
Joined: Wed Apr 18, 2012 2:25 pm

Re: 11360 - Have Fun with Matrices ( Java Strange Problem )

Post by nass » Thu Apr 19, 2012 12:13 am

Thanks for reply :)

But i still got RE.
When i was commented reader/write close and replace writer.println with System.out.println
In Ideone the result is success , but in uva still got RE :( , and i also tested the new changes again in my system and also works fine

http://ideone.com/afTdv

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11360 - Have Fun with Matrices ( Java Strange Problem )

Post by brianfry713 » Thu Apr 19, 2012 11:11 pm

Your output is wrong for the second case. Try this input:

Code: Select all

1
3
000
111
000
1
row 1 3
Check input and AC output for thousands of problems on uDebug!

nass
New poster
Posts: 3
Joined: Wed Apr 18, 2012 2:25 pm

Re: 11360 - Have Fun with Matrices ( Java Strange Problem )

Post by nass » Fri Apr 20, 2012 11:30 am

Thank you very much :)
I saw my mistake :)
So now i got WA, and i will try to got AC :)

Thank you again !

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11360 - Have Fun with Matrices

Post by brianfry713 » Fri Jun 28, 2013 1:52 am

Input:

Code: Select all

49
2
67
53
35
dec
transpose
col 2 1
transpose
inc
col 2 1
inc
dec
transpose
dec
dec
row 1 2
transpose
inc
col 1 2
transpose
row 1 2
transpose
col 2 1
transpose
row 1 2
inc
row 1 2
inc
dec
row 1 2
inc
inc
col 2 1
inc
dec
col 1 2
transpose
inc
col 2 1
6
307868
843149
206892
664950
487172
722610
36
dec
inc
col 5 6
inc
col 4 2
transpose
dec
dec
inc
col 2 4
dec
transpose
row 1 6
dec
row 6 3
row 4 3
col 4 6
inc
row 5 6
inc
col 1 6
row 2 3
dec
dec
inc
col 5 3
row 2 3
row 5 3
col 1 5
transpose
dec
row 4 6
inc
col 5 6
transpose
col 2 3
8
97538831
89643338
60488897
76430309
25405946
92247754
81289368
02105110
28
inc
inc
dec
col 2 5
dec
transpose
row 5 6
transpose
col 1 5
transpose
col 4 7
row 8 6
dec
dec
inc
row 7 5
row 8 6
col 5 8
row 6 5
inc
inc
dec
dec
col 5 3
col 1 7
dec
transpose
inc
7
9872829
9602761
3215991
4910758
7048042
9610422
2055290
42
row 1 3
inc
col 5 4
dec
col 5 6
inc
col 2 3
col 1 3
inc
transpose
col 4 3
inc
dec
transpose
col 6 3
col 6 5
col 7 1
dec
col 5 7
row 2 3
transpose
row 1 2
dec
row 5 2
row 5 4
col 5 1
row 1 6
dec
row 5 6
inc
row 3 7
transpose
row 2 6
inc
transpose
dec
inc
row 3 5
dec
inc
col 1 2
col 3 6
6
862479
392830
178915
492574
994593
570819
39
transpose
row 1 6
row 1 4
inc
transpose
inc
dec
col 6 1
inc
transpose
row 6 4
col 1 4
dec
transpose
transpose
col 1 5
col 6 3
row 4 3
transpose
dec
inc
dec
dec
col 5 3
row 2 1
inc
transpose
inc
dec
inc
dec
row 3 5
col 2 3
inc
transpose
col 3 2
col 3 6
dec
inc
7
7886046
7609759
7853383
7937874
1909885
8437138
0979932
44
row 7 2
transpose
transpose
inc
transpose
dec
transpose
inc
dec
transpose
col 7 1
dec
dec
dec
transpose
inc
col 7 3
inc
dec
dec
dec
transpose
dec
col 4 6
row 4 5
dec
inc
transpose
transpose
col 2 4
dec
col 3 6
transpose
col 1 4
col 6 1
inc
row 2 4
dec
inc
col 5 7
col 5 2
row 4 2
transpose
inc
7
4636334
4397258
9024765
7133385
1087635
0804113
5934150
18
row 6 1
col 5 4
dec
row 3 7
dec
inc
inc
dec
inc
inc
row 4 5
transpose
dec
col 1 7
col 5 4
col 1 4
transpose
row 7 6
9
003492742
524438608
922318342
245175716
981333798
670484816
852199606
499089314
896773712
22
dec
inc
inc
col 9 8
inc
dec
row 7 9
dec
dec
row 6 9
transpose
dec
transpose
inc
dec
inc
col 5 2
dec
transpose
transpose
col 4 8
inc
8
85927364
79722163
02156500
34660258
95060837
82105855
07382307
77691190
28
col 7 1
inc
row 2 3
dec
col 1 4
transpose
transpose
col 2 7
transpose
transpose
dec
inc
row 3 1
inc
dec
inc
dec
row 3 1
row 2 7
transpose
inc
transpose
col 6 1
inc
transpose
row 5 8
transpose
dec
6
494195
741221
620229
743561
403127
798107
6
inc
dec
inc
transpose
inc
dec
6
713120
687492
445912
896064
094546
639952
21
row 1 6
col 3 4
row 4 6
row 6 3
col 2 5
dec
inc
row 2 5
dec
row 6 5
inc
dec
dec
inc
row 5 3
col 4 5
transpose
col 2 4
col 5 4
row 2 1
row 6 4
6
461561
722928
124786
377237
253768
136403
35
row 2 3
col 6 5
inc
transpose
col 2 1
dec
transpose
inc
inc
dec
row 2 5
row 2 3
transpose
row 4 1
inc
inc
inc
row 2 1
inc
dec
transpose
col 6 1
row 4 2
col 1 6
transpose
col 5 6
inc
row 6 2
col 3 6
col 3 1
inc
dec
inc
col 2 1
dec
4
4372
7339
2444
9938
3
transpose
col 2 1
row 4 3
8
55739072
72905041
79362125
39188705
27919636
84667274
10064437
34721795
6
row 6 2
inc
transpose
dec
inc
col 8 2
6
210532
197682
064336
904851
297380
923187
4
dec
dec
row 5 4
inc
6
126485
625269
133152
694460
743790
022690
3
inc
inc
row 6 4
7
0604130
2960935
4364319
1094562
5917741
1913874
9313879
43
row 6 1
inc
inc
row 5 1
row 2 3
transpose
dec
row 1 6
row 1 7
transpose
row 2 7
transpose
col 7 6
row 6 3
row 2 7
col 1 7
dec
col 7 6
col 7 4
row 5 1
inc
dec
col 2 1
inc
transpose
row 6 5
row 3 6
dec
col 3 7
col 4 5
row 1 4
transpose
row 3 2
transpose
dec
col 3 4
row 1 2
inc
transpose
col 1 2
dec
row 3 5
col 1 3
8
32362247
04965464
25161377
12108901
34858220
63610574
20033904
33424538
1
dec
2
15
81
13
row 2 1
col 2 1
transpose
transpose
dec
inc
dec
row 1 2
col 2 1
col 1 2
col 1 2
col 1 2
transpose
7
9302799
5208359
6563020
7473016
7578890
7803103
6732215
3
row 7 4
row 1 2
inc
6
693374
371396
420295
746491
231813
892451
40
inc
dec
row 6 3
inc
inc
transpose
transpose
transpose
col 1 6
col 6 3
dec
inc
inc
dec
col 6 5
dec
inc
col 6 1
transpose
dec
col 2 5
dec
transpose
inc
row 4 6
row 2 3
col 1 6
inc
dec
inc
col 2 3
dec
transpose
row 6 4
inc
transpose
transpose
transpose
row 2 4
transpose
9
798898052
024373001
580004753
142013004
822024584
084254275
752286600
912694828
278677094
5
col 5 1
transpose
col 5 9
inc
dec
7
2284311
1900025
7691987
6511485
7669143
6769760
9076687
27
dec
dec
inc
row 7 4
col 7 5
dec
col 3 1
inc
col 7 4
transpose
row 6 4
inc
transpose
dec
dec
col 2 5
row 1 7
dec
inc
inc
transpose
inc
row 4 3
col 6 4
col 5 1
transpose
transpose
2
23
27
23
col 1 2
inc
inc
dec
col 1 2
row 1 2
dec
inc
col 1 2
dec
dec
col 1 2
inc
inc
inc
inc
dec
dec
inc
transpose
row 2 1
row 2 1
transpose
8
25505297
76812032
87463804
97975137
80952132
73323861
60919150
94968246
45
row 7 4
col 2 4
col 3 5
row 4 2
col 3 2
inc
inc
col 6 1
transpose
inc
dec
col 4 5
inc
transpose
inc
row 1 8
inc
inc
dec
dec
transpose
row 1 7
row 3 1
dec
inc
row 4 2
dec
col 3 4
dec
row 4 8
row 4 2
dec
inc
col 4 3
col 6 1
dec
col 1 4
transpose
inc
dec
row 7 1
inc
dec
col 1 3
inc
5
67544
60553
91504
96743
09660
44
inc
row 3 4
dec
row 1 4
col 1 2
transpose
transpose
row 1 4
col 3 4
row 5 3
transpose
inc
inc
transpose
col 4 1
dec
transpose
dec
inc
dec
dec
row 5 2
transpose
dec
row 1 4
transpose
col 1 2
inc
row 3 4
row 3 2
row 4 5
row 1 5
dec
transpose
transpose
transpose
transpose
col 2 5
inc
col 3 4
transpose
dec
row 1 4
dec
1
4
25
transpose
dec
dec
inc
transpose
dec
transpose
dec
dec
dec
dec
inc
transpose
dec
inc
dec
transpose
transpose
inc
transpose
transpose
inc
inc
dec
transpose
3
672
144
849
8
col 2 3
row 3 2
row 3 1
row 2 1
inc
dec
transpose
dec
6
826759
399797
350419
414364
227618
511306
44
col 6 5
transpose
transpose
row 2 4
transpose
col 3 5
inc
dec
dec
col 6 1
row 6 5
transpose
col 4 6
col 5 6
dec
transpose
inc
dec
inc
dec
col 5 3
dec
inc
row 2 5
col 3 1
dec
row 1 5
transpose
col 2 1
dec
inc
dec
col 3 1
dec
row 1 5
col 6 3
inc
dec
dec
dec
col 5 6
col 5 4
col 1 3
transpose
8
68928673
53595979
90521020
63694840
84482427
79939840
80590918
28768489
48
row 4 7
transpose
dec
col 7 4
inc
dec
col 1 7
dec
dec
dec
dec
transpose
row 3 4
dec
inc
col 5 8
transpose
row 5 1
row 4 5
inc
col 8 4
transpose
transpose
transpose
col 3 5
transpose
row 6 3
dec
row 1 6
transpose
transpose
dec
row 7 2
row 5 6
dec
row 1 7
row 7 4
dec
col 8 4
col 2 1
inc
transpose
dec
col 4 8
row 6 2
transpose
row 4 5
row 1 7
1
7
21
inc
transpose
inc
dec
dec
inc
inc
dec
inc
dec
dec
transpose
transpose
inc
inc
inc
transpose
inc
dec
transpose
dec
6
639697
560527
663243
604363
749429
382454
13
transpose
transpose
col 6 1
dec
dec
dec
dec
row 2 5
col 6 3
col 5 1
transpose
transpose
transpose
6
610072
310748
018734
713442
464984
257274
4
inc
inc
dec
inc
7
4032086
9923548
1072499
2366774
6960995
1730854
3946238
26
transpose
transpose
inc
transpose
dec
transpose
col 4 2
transpose
col 1 4
inc
row 7 1
transpose
row 3 6
col 2 7
inc
transpose
row 3 1
transpose
dec
col 3 7
dec
transpose
row 1 5
dec
inc
dec
8
79076933
64984699
78014359
43855283
18270526
11788677
49002716
20482233
2
transpose
transpose
3
541
680
488
33
inc
transpose
col 3 1
transpose
dec
col 2 1
row 1 2
inc
transpose
inc
dec
inc
dec
dec
inc
row 2 1
transpose
row 2 3
inc
dec
inc
inc
inc
row 2 1
row 3 2
dec
inc
inc
row 1 2
dec
inc
dec
row 3 1
4
8236
0907
0200
0408
31
dec
col 2 1
dec
col 4 3
row 1 3
col 3 2
dec
row 2 1
row 4 2
row 4 1
transpose
row 4 3
transpose
row 3 4
transpose
row 3 2
transpose
col 2 4
row 4 1
col 2 3
transpose
transpose
row 1 4
transpose
row 4 1
dec
inc
col 3 1
row 1 2
inc
transpose
3
229
138
137
6
dec
col 3 2
inc
dec
row 1 2
col 2 1
3
944
919
934
31
transpose
inc
transpose
transpose
dec
inc
dec
col 1 3
row 3 2
transpose
row 2 3
inc
transpose
col 1 3
row 1 3
col 1 3
inc
dec
col 3 1
dec
dec
row 2 3
row 2 3
dec
dec
inc
inc
col 1 2
dec
inc
inc
4
8918
1097
3912
6266
45
inc
inc
col 4 3
transpose
transpose
dec
row 3 2
col 3 2
col 2 1
row 1 4
transpose
dec
col 4 1
inc
dec
dec
col 2 1
inc
dec
row 1 2
col 4 3
inc
dec
col 4 3
inc
col 2 1
inc
row 4 2
col 2 1
transpose
col 1 4
col 2 1
dec
row 2 3
col 3 2
inc
col 3 1
transpose
dec
transpose
dec
transpose
dec
row 1 3
inc
3
866
961
859
16
dec
dec
transpose
inc
inc
dec
row 1 3
inc
col 2 1
dec
dec
dec
dec
dec
row 1 2
row 3 1
5
23050
72802
35430
71887
42212
1
transpose
8
63608870
89984268
78598364
71594420
00081719
90934731
78253121
29264696
19
col 1 7
col 8 6
inc
transpose
transpose
row 8 1
row 8 4
dec
dec
col 8 1
dec
col 5 3
transpose
row 1 6
transpose
transpose
col 4 2
dec
col 1 2
7
6299678
7526747
1180666
0905870
4660062
6524142
0103404
30
dec
transpose
transpose
transpose
transpose
transpose
inc
dec
col 7 6
dec
transpose
inc
transpose
col 5 6
col 2 1
row 3 7
col 3 7
inc
inc
row 5 4
inc
dec
transpose
dec
row 2 7
inc
transpose
transpose
transpose
dec
6
113638
663523
726568
022324
823857
288773
25
row 4 3
row 6 1
inc
inc
transpose
transpose
dec
transpose
inc
dec
inc
row 3 6
col 4 1
transpose
inc
dec
dec
inc
dec
row 4 6
row 3 1
dec
dec
row 2 5
row 4 5
4
5185
2907
6007
3270
7
dec
row 2 4
dec
row 2 3
col 4 2
row 4 2
inc
1
8
30
inc
transpose
transpose
inc
dec
inc
inc
inc
dec
inc
dec
inc
dec
dec
inc
inc
inc
transpose
dec
dec
dec
inc
inc
dec
transpose
inc
dec
dec
dec
transpose
8
51817682
47733377
89646454
20977544
65651495
27170061
02586320
31926674
31
row 8 3
col 6 2
dec
inc
transpose
dec
transpose
inc
transpose
row 2 7
dec
inc
row 3 6
dec
col 2 4
inc
transpose
transpose
transpose
inc
col 2 4
col 5 8
inc
inc
dec
row 3 2
col 8 1
inc
inc
transpose
row 2 4
6
493380
371512
213274
596490
417905
566104
21
inc
transpose
col 4 6
transpose
inc
dec
transpose
transpose
inc
transpose
col 6 4
row 5 2
col 2 4
row 6 3
dec
transpose
col 3 6
row 4 6
transpose
transpose
inc
AC output:

Code: Select all

Case #1
68
09

Case #2
195610
398554
517198
677295
610376
280733

Case #3
29325968
22538277
04091099
28170577
77379856
66131483
77426280
84394315

Case #4
3563070
7109371
2528216
3390221
0850403
5189083
1913636

Case #5
491340
690128
064500
950387
565380
206928

Case #6
1939440
6993614
5408192
3436733
2055544
3745496
5335592

Case #7
7133385
4392758
5931450
9027465
1086735
0801413
4633634

Case #8
982191633
423717539
801117223
164534600
820772628
781548509
765182660
378388290
579563730

Case #9
49075368
41418983
28874303
34769751
90148761
99266136
61211637
28701082

Case #10
587858
053510
521449
233622
033731
620288

Case #11
410538
563795
808943
191351
824536
203887

Case #12
217780
813751
269718
896267
261383
702492

Case #13
7429
3349
9248
3743

Case #14
64843829
65008315
88420017
43792177
02390658
18287153
80314548
36667285

Case #15
109421
086571
953225
186279
893740
812076

Case #16
348607
847481
355374
244812
965912
816682

Case #17
7027684
8522889
2332693
6206325
3988041
0950058
0938410

Case #18
21251136
93854353
14050266
01097890
23747119
52509463
19922893
22313427

Case #19
40
07

Case #20
6319460
0413800
7674131
7843326
8689901
8914214
8584127

Case #21
671244
869515
581395
453350
037416
931866

Case #22
970175892
928478512
840284222
830062260
705120798
834374644
007002685
505097028
213445084

Case #23
6096178
3570571
4286881
7176692
6967502
1097463
9019164

Case #24
49
45

Case #25
59991137
72321831
26896005
83455905
54380924
68861140
54721034
19277447

Case #26
36773
13064
14132
27032
78162

Case #27
0

Case #28
705
831
336

Case #29
493248
544285
074239
966070
179022
578661

Case #30
79810084
96644390
10026186
12229051
71634200
71876719
51526200
15140148

Case #31
9

Case #32
580281
902624
232219
208910
359930
559068

Case #33
832294
532960
230956
935664
686106
479496

Case #34
6479831
1803502
5291915
2869898
5122563
6347882
3735487

Case #35
79076933
64984699
78014359
43855283
18270526
11788677
49002716
20482233

Case #36
024
985
822

Case #37
5887
6882
8880
4160

Case #38
702
811
602

Case #39
413
494
999

Case #40
0805
8981
1675
2075

Case #41
433
614
110

Case #42
27374
32512
08482
50381
02072

Case #43
73156887
06567758
51518101
73655026
39267692
53094481
39457644
46338099

Case #44
7160046
5159162
7620428
7618406
6045309
4647067
2820069

Case #45
913211
716742
617455
552412
007522
172667

Case #46
4470
1698
2961
5699

Case #47
9

Case #48
10175400
21813069
55419163
56179128
68819548
23310590
00978478
97680642

Case #49
605512
718612
495436
728386
629137
533794

Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 113 (11300-11399)”