用java写,为什么全部是RE

P3613 【深基15.例2】寄包柜

a1610874650 @ 2021-11-05 09:50:57

package testjava;

import java.util.Scanner;
import java.util.Vector;

public class test
{
    public static void main(String[] args)
    {
        int N = (int) (1e5+5);
        node[] nodes = new node[N];
        int n,q;
        Scanner scanner = new Scanner(System.in);
        n= scanner.nextInt();
        q= scanner.nextInt();

        while (q>0)
        {

            int x;
            x= scanner.nextInt();
            if (x==1)
            {
                int i,j,k;
                i= scanner.nextInt();
                j= scanner.nextInt();
                k= scanner.nextInt();
                nodes[i]=new node();
                nodes[i].s= nodes[i].s+1;
                nodes[i].v1.add(j);
                nodes[i].v2.add(k);

            }
            else
            {
                int b,c;

                b= scanner.nextInt();
                c= scanner.nextInt();
                if (nodes[b]==null)
                {
                    nodes[b]=new node();
                }
                for (int i=nodes[b].s-1;i>=0;i--)
                {
                    if (c == nodes[b].v1.get(i))
                    {
                        System.out.println(nodes[b].v2.get(i));
                        break;
                    }
                }

            }
            q--;
        }

    }
}
class node
{

    public int s=0;
    Vector<Integer> v1 =new Vector();
    Vector<Integer> v2 =new Vector();

}

by Echidna @ 2021-11-05 11:31:49

@a1610874650

公共类名为 Main

把你 package 去了


|