Java rpc错误:code=2 desc=oci运行时错误:exec失败:参数列表太长
试图使用二进制搜索、快速排序和Get-rpc错误:code=2 desc=oci运行时错误:exec失败:参数列表太长。我查找了这个错误,但没有找到任何与java相关的答案Java rpc错误:code=2 desc=oci运行时错误:exec失败:参数列表太长,java,arrays,quicksort,Java,Arrays,Quicksort,试图使用二进制搜索、快速排序和Get-rpc错误:code=2 desc=oci运行时错误:exec失败:参数列表太长。我查找了这个错误,但没有找到任何与java相关的答案 // package comcoding; /* IMPORTANT: Multiple classes and nested static classes are supported */ /* * uncomment this if you want to read input. //imports for Buff
// package comcoding;
/* IMPORTANT: Multiple classes and nested static classes are supported */
/*
* uncomment this if you want to read input.
//imports for BufferedReader
import java.io.BufferedReader;
import java.io.InputStreamReader;
*/
//import for Scanner and other utility classes
import java.util.*;
// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
public class TestClass {
public static void main(String args[] ) throws Exception {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt(),m=sc.nextInt(),q=sc.nextInt();
Long z=Long.valueOf(0),l1=Long.valueOf(0),r1=Long.valueOf(0),l2=Long.valueOf(0),r2=Long.valueOf(0),c=Long.valueOf(0);
char ch='a';
Long x[]=new Long[n];
Long y[]=new Long[m];
for(int i=0;i<n;i++)
x[i]=sc.nextLong();
TestClass.quicksort(x,0,n-1);
// for(int i=0;i<n;i++)
// System.out.print(i+" xi "+x[i]+" ; ");
// System.out.println();
for(int i=0;i<m;i++)
y[i]=sc.nextLong();
TestClass.quicksort(y,0,m-1);
// for(int i=0;i<m;i++)
// System.out.print(i+" yi "+y[i]+" ; ");
// System.out.println();
for(int i=0;i<q;i++){
// ArrayList<Integer> xx=new ArrayList<Integer>();
//doubt if previous loop data exists in it
z=sc.nextLong();
ch=sc.next().charAt(0);;
if(ch=='A'){
// System.out.println("entered a");
l1=sc.nextLong();
r1=sc.nextLong();
// System.out.println("l1 "+l1+" r1 "+r1);
// for(int j=0;j<n;j++){
// if((x[j]>=l1)&&(x[j]<=r1)){
// xx.add(x[j]);
// // System.out.print("x1 "+x[j]+" ");
// }
// }
int lo=TestClass.binarysearch(x,l1,true),up=TestClass.binarysearch(x,r1,false);
// System.out.println("l000000ooooo "+lo+" upppppppppppppp "+up);
int s=0,t=0;
for(int k=lo;k<=up;k++){
for(int f=0;f<m;f++){
// System.out.println("lo");
if((y[f]+x[k])<=z){
c++;
}
}
}
}
if(ch=='B'){
// System.out.println("entered b");
l2=sc.nextLong();
r2=sc.nextLong();
// System.out.println("l1 "+l2+" r1 "+r2);
// for(int j=0;j<n;j++){
// if((x[j]>=l1)&&(x[j]<=r1)){
// xx.add(x[j]);
// // System.out.print("x1 "+x[j]+" ");
// }
// }
int lo=TestClass.binarysearch(y,l2,true),up=TestClass.binarysearch(y,r2,false);
// System.out.println("l000000ooooo "+lo+" upppppppppppppp "+up);
int s=0,t=0;
for(int k=lo;k<=up;k++){
for(int f=0;f<n;f++){
// System.out.println("lo");
if((x[f]+y[k])<=z){
c++;
}
}
}
}
if(ch=='C'){
// System.out.println("entered0 c");
l1=sc.nextLong();
r1=sc.nextLong();
l2=sc.nextLong();
r2=sc.nextLong();
// System.out.println("l1 "+l1+" r1 "+r1+" l2 "+l2+" r2 "+r2);
// for(int j=0;j<n;j++){
// if((x[j]>=l1)&&(x[j]<=r1)){
// xx.add(x[j]);
// // System.out.print("x1 "+x[j]+" ");
// }
// }
int low=TestClass.binarysearch(x,l1,true),upp=TestClass.binarysearch(x,r1,false),lo=TestClass.binarysearch(y,l2,true),up=TestClass.binarysearch(y,r2,false);
// System.out.println("l000000oooooww "+low+" uppppppppppppppeer "+upp+" l000000ooooo "+lo+" upppppppppppppp "+up);
// System.out.println("---------------------------------low -- "+(low!=0)+"--------------uppp " +(upp!=0)+"------------------ "+((low!=0)||(upp!=0))+" second finallll "+(((low!=0)||(upp!=0))&&((lo!=0)||(up!=0))) );
// System.out.println("ccccccccccc "+c);
int s=0,t=0;
if(((low!=0)||(upp!=0))&&((lo!=0)||(up!=0))){
for(int k=lo;k<=up;k++){
for(int f=low;f<=upp;f++){
// System.out.println("lo");
if((x[f]+y[k])<=z){
c++;
}
}
}}
}
// System.out.println("cccccccc-------"+c);
// if((i+1)==11){
// System.out.println("i "+(i+1)+" "+z+" "+ch+" "+l1+" "+r1+" "+l2+" "+r2);
// }
// System.out.println("i "+(i+1)+" c "+c+" ");
System.out.println(c);
c=Long.valueOf(0);
}
}
static int binarysearch(Long[] x,Long l1,boolean ch){
int l=0,u=x.length-1,m=0;
while(l<=u){
m=(l+u)/2;
if(x[m]<l1){
l=m+1;
}
else if(x[m]>l1){
u=m-1;
}else{
// System.out.println("hellllooooo "+a[m]);
return m;
}
}
if((ch)&&(x[m]<l1)){
return m+1;
}else if((!ch)&&(x[m]>l1)){
if((m-1)>0)
return m-1;
}
return m;
}
static void quicksort(Long[] x,int l,int h){
if(l<h){
int p=TestClass.partition(x,l,h);
TestClass.quicksort(x,l,p-1);
// System.out.println("l "+l+"h "+h+"----+++++++-------");
TestClass.quicksort(x,p+1,h);
}
}
static int partition(Long[] x,int l,int h){
int ll=l,hh=h;
Long y=Long.valueOf(0);
Long p=x[l];
l++;
// System.out.println("ll "+ll+"hh "+hh+"----------- p "+p);
while(l<h){
while((l<hh)&&(x[l]<p)){
l++;
}
// System.out.println("l- "+l+" h- "+h);
while((h>ll)&&(x[h]>p)){
h--;
}
// System.out.println("after l- "+l+" h- "+h);
if(l<h){
y=x[l];
x[l]=x[h];
x[h]=y;
// System.out.println("l<h al- "+x[l]+" xh- "+x[h]);
}
}
// System.out.println("exit while l- "+l+" h- "+h);
if((ll<hh)&&(x[ll]>x[h])){
y=x[h];
x[h]=x[ll];
x[ll]=y;
// System.out.println("end al- "+x[ll]+" ah- "+x[h]);
// System.out.println("l- "+l+" h- "+h);
}
// System.out.println();
// System.out.println(" ret l- "+l+" h- "+h);
// System.out.println("-------------------------------------------------------------------");
// 637544453401 C 3101614662 3287893408 266524764215 308526940985
return h;
}
}
//包编码;
/*要点:支持多个类和嵌套的静态类*/
/*
*如果要读取输入,请取消对此的注释。
//BufferedReader的导入
导入java.io.BufferedReader;
导入java.io.InputStreamReader;
*/
//为扫描仪和其他实用程序类导入
导入java.util.*;
//警告:将不需要的或格式错误的数据打印到输出将导致测试用例失败
公共类TestClass{
公共静态void main(字符串args[])引发异常{
扫描仪sc=新的扫描仪(System.in);
int n=sc.nextInt(),m=sc.nextInt(),q=sc.nextInt();
长z=Long.valueOf(0),l1=Long.valueOf(0),r1=Long.valueOf(0),l2=Long.valueOf(0),r2=Long.valueOf(0),c=Long.valueOf(0);
char ch='a';
长x[]=新长[n];
长y[]=新长[m];
对于(int i=0;i这不像Java错误那样锁定,更像是超过了最大命令行长度-大多数系统限制命令行的长度:
见
或
一个想法是,从标准输入或文件中读取输入并使用更多行
也许你可以编辑问题并添加代码的启动方式。我已经再次编辑了我的问题。很抱歉没有将问题正确地写入stalkoverflow。我确实联系过他们,等待他们的答复。你知道像eclipse这样可以执行100001000000个输入的应用程序吗?我从Hacker那里为我的java程序获得了这些输入阿尔斯的问题。