Guest User

Untitled

a guest
Mar 30th, 2017
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #pragma comment(linker, "/stack:16777216")
  3. #include <string>
  4. #include <vector>
  5. #include <map>
  6. #include <list>
  7. #include <iterator>
  8. #include <cassert>
  9. #include <set>
  10. #include <queue>
  11. #include <iostream>
  12. #include <sstream>
  13. #include <stack>
  14. #include <deque>
  15. #include <cmath>
  16. #include <memory.h>
  17. #include <cstdlib>
  18. #include <cstdio>
  19. #include <cctype>
  20. #include <algorithm>
  21. #include <utility>
  22. #include <fstream>
  23. #include <time.h>
  24. using namespace std;
  25.  
  26. #define FOR(i, a, b) for(int i=(a);i<(b);i++)
  27. #define RFOR(i, b, a) for(int i=(b)-1;i>=(a);--i)
  28. #define FILL(A,value) memset(A,value,sizeof(A))
  29.  
  30. #define ALL(V) V.begin(), V.end()
  31. #define SZ(V) (int)V.size()
  32. #define PB push_back
  33. #define MP make_pair
  34. #define Pi 3.14159265358979
  35. #define x0 ikjnrmthklmnt
  36. #define y0 lkrjhkltr
  37. #define y1 ewrgrg
  38.  
  39. typedef long long Int;
  40. typedef unsigned long long UInt;
  41. typedef vector<int> VI;
  42. typedef pair<int, int> PII;
  43. typedef pair<Int, Int> PLL;
  44. typedef pair<double, double> PDD;
  45.  
  46. const int INF = 1000000000;
  47. const int BASE = 1000000007;
  48. const int MAX = 2000 * 100 + 7;
  49. const int MAX2 = 10007;
  50. const int MAXE = 100000;
  51. const int ADD = 1000000;
  52. const int MOD = 1000000007;
  53. const int CNT = 0;
  54.  
  55. void fail()
  56. {
  57. throw - 1;
  58. }
  59.  
  60. string imp = "Oh sh*t";
  61.  
  62. int main(int argc, char* argv[])
  63. {
  64. try
  65. {
  66. ifstream in(argv[1]);
  67. ifstream user(argv[2]);
  68. ifstream ans(argv[3]);
  69.  
  70. int n, k;
  71. in >> n >> k;
  72. VI A;
  73. FOR (i,0,n)
  74. {
  75. int x;
  76. in >> x;
  77. A.PB(x);
  78. }
  79.  
  80. string su, sa;
  81. getline(user, su);
  82. getline(ans, sa);
  83. if ((su == imp) != (sa == imp))
  84. fail();
  85.  
  86. if (su != imp)
  87. {
  88. VI U;
  89. int x;
  90. stringstream ss;
  91. ss << su;
  92. while (ss >> x)
  93. U.PB(x);
  94.  
  95. if (SZ(U) != SZ(A) || A.empty())
  96. fail();
  97.  
  98. int cnt = 0, mx = 0;
  99. FOR (i,0,SZ(U))
  100. {
  101. if (i == 0 || U[i-1] == U[i])
  102. ++ cnt;
  103. else
  104. cnt = 1;
  105. mx = max(mx, cnt);
  106. }
  107. if (mx < k)
  108. fail();
  109. sort(ALL(A));
  110. sort(ALL(U));
  111. if (A != U)
  112. fail();
  113. }
  114.  
  115. string trash;
  116. if (user >> trash)
  117. fail();
  118. }
  119. catch (...){
  120. cout << "Checker error" << endl;
  121. }
  122. }
Add Comment
Please, Sign In to add comment