fork(4) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ms(s,n) memset(s,n,sizeof(s))
  5. #define all(a) a.begin(),a.end()
  6. #define present(t, x) (t.find(x) != t.end())
  7. #define sz(a) int((a).size())
  8. #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
  9. #define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
  10. #define pb push_back
  11. #define pf push_front
  12. #define fi first
  13. #define se second
  14. #define mp make_pair
  15.  
  16. typedef long long ll;
  17. typedef unsigned long long ull;
  18. typedef long double ld;
  19. typedef pair<int,int> pi;
  20. typedef vector<int> vi;
  21. typedef vector<pi> vii;
  22.  
  23. const int MOD = (int) 1e9+7;
  24. const int INF = (int) 1e9+1;
  25. inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
  26. inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
  27.  
  28.  
  29. void FileIO(){
  30. freopen("input.txt","r", stdin);
  31. freopen("output.txt","w",stdout);
  32. }
  33.  
  34. int n,m,k;
  35.  
  36. void inp(){
  37. cin>>n>>m>>k;
  38. ll a[n],b[m],c[k];
  39. FOR(i,0,n) cin>>a[i];
  40. FOR(i,0,m) cin>>b[i];
  41. FOR(i,0,k) cin>>c[i];
  42. int i=0,j=0,l=0;
  43. vector<ll> res;
  44. while(i<n && j<m && l<k){
  45. if(a[i]==b[j] && b[j]==c[l]){
  46. res.pb(a[i]);
  47. ++i;++j;++l;
  48. }
  49. else if(a[i]<=b[j] && a[i]<=c[l]){
  50. ++i;
  51. }
  52. else if(b[j]<=a[i] && b[j]<=c[l]){
  53. ++j;
  54. }
  55. else
  56. ++l;
  57. }
  58. if(sz(res)==0){
  59. cout<<"-1\n";
  60. return;
  61. }
  62. for(ll x : res)
  63. cout<<x<<" ";
  64. cout<<"\n";
  65. }
  66.  
  67. int main(){
  68. //FileIO();
  69. ios::sync_with_stdio(false);
  70. cin.tie(nullptr);
  71. int t;cin>>t;
  72. while(t--){
  73. inp();
  74. }
  75. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
Main.java:4: error: illegal character: '#'
#define ms(s,n) memset(s,n,sizeof(s))
^
Main.java:4: error: class, interface, or enum expected
#define ms(s,n) memset(s,n,sizeof(s))
        ^
Main.java:5: error: illegal character: '#'
#define all(a) a.begin(),a.end()
^
Main.java:6: error: illegal character: '#'
#define present(t, x) (t.find(x) != t.end())
^
Main.java:7: error: illegal character: '#'
#define sz(a) int((a).size())
^
Main.java:8: error: illegal character: '#'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:8: error: class, interface, or enum expected
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
                                       ^
Main.java:8: error: class, interface, or enum expected
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
                                                ^
Main.java:9: error: illegal character: '#'
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
^
Main.java:9: error: class, interface, or enum expected
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
                                            ^
Main.java:9: error: class, interface, or enum expected
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
                                                      ^
Main.java:10: error: illegal character: '#'
#define pb push_back
^
Main.java:11: error: illegal character: '#'
#define pf push_front
^
Main.java:12: error: illegal character: '#'
#define fi first
^
Main.java:13: error: illegal character: '#'
#define se second
^
Main.java:14: error: illegal character: '#'
#define mp make_pair
^
Main.java:17: error: class, interface, or enum expected
typedef unsigned long long ull;
^
Main.java:18: error: class, interface, or enum expected
typedef long double ld;
^
Main.java:19: error: class, interface, or enum expected
typedef pair<int,int> pi;
^
Main.java:20: error: class, interface, or enum expected
typedef vector<int> vi;
^
Main.java:21: error: class, interface, or enum expected
typedef vector<pi> vii;
^
Main.java:23: error: class, interface, or enum expected
const int MOD = (int) 1e9+7;
^
Main.java:24: error: class, interface, or enum expected
const int INF = (int) 1e9+1;
^
Main.java:25: error: class, interface, or enum expected
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
^
Main.java:25: error: class, interface, or enum expected
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
                              ^
Main.java:25: error: class, interface, or enum expected
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
                                             ^
Main.java:25: error: class, interface, or enum expected
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
                                                 ^
Main.java:25: error: class, interface, or enum expected
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
                                                     ^
Main.java:25: error: class, interface, or enum expected
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
                                                               ^
Main.java:26: error: class, interface, or enum expected
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
                                             ^
Main.java:31: error: class, interface, or enum expected
	freopen("output.txt","w",stdout);
	^
Main.java:32: error: class, interface, or enum expected
}
^
Main.java:36: error: class, interface, or enum expected
void inp(){
^
Main.java:38: error: class, interface, or enum expected
	ll a[n],b[m],c[k];
	^
Main.java:39: error: class, interface, or enum expected
	FOR(i,0,n) cin>>a[i];
	^
Main.java:40: error: class, interface, or enum expected
	FOR(i,0,m) cin>>b[i];
	^
Main.java:41: error: class, interface, or enum expected
	FOR(i,0,k) cin>>c[i];
	^
Main.java:42: error: class, interface, or enum expected
	int i=0,j=0,l=0;
	^
Main.java:43: error: class, interface, or enum expected
	vector<ll> res;
	^
Main.java:44: error: class, interface, or enum expected
	while(i<n && j<m && l<k){
	^
Main.java:47: error: class, interface, or enum expected
			++i;++j;++l;
			^
Main.java:47: error: class, interface, or enum expected
			++i;++j;++l;
			    ^
Main.java:47: error: class, interface, or enum expected
			++i;++j;++l;
			        ^
Main.java:48: error: class, interface, or enum expected
		}
		^
Main.java:51: error: class, interface, or enum expected
		}
		^
Main.java:54: error: class, interface, or enum expected
		}
		^
Main.java:57: error: class, interface, or enum expected
	}
	^
Main.java:60: error: class, interface, or enum expected
		return;
		^
Main.java:61: error: class, interface, or enum expected
	}
	^
Main.java:64: error: class, interface, or enum expected
	cout<<"\n";
	^
Main.java:65: error: class, interface, or enum expected
}
^
Main.java:70: error: class, interface, or enum expected
	cin.tie(nullptr);
	^
Main.java:71: error: class, interface, or enum expected
	int t;cin>>t;
	^
Main.java:71: error: class, interface, or enum expected
	int t;cin>>t;
	      ^
Main.java:72: error: class, interface, or enum expected
	while(t--){
	^
Main.java:74: error: class, interface, or enum expected
	}
	^
58 errors
stdout
Standard output is empty