Submission #1109308

#TimeUsernameProblemLanguageResultExecution timeMemory
1109308MuhammetSegments (IZhO18_segments)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define sz(s) (int)s.size() #define ff first #define ss second int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, t, ans = 0, ind = 0; cin >> n >> t; vector <pair<int,int>> v; vector <int> vis(n+1,0); for(int i = 1; i <= n; i++){ int t1; cin >> t1; if(t1 == 1){ int a, b; cin >> a >> b; ind++; a = (a ^ (t * ans)); b = (b ^ (t * ans)); if(a > b) swap(a,b); v.push_back({a,b}); } if(t1 == 2){ int id, in = 0; cin >> id; vis[--id] = true; } if(t1 == 3){ int a, b, k; cin >> a >> b >> k; a = (a ^ (t * ans)); b = (b ^ (t * ans)); if(a > b) swap(a,b); ans = 0; for(int j = 0; j < sz(v); j++){ if(vis[j]) continue; ans += ((min(b,v[j].ss) - max(a,v[j].ff)) >= k-1); } cout << ans << '\n'; } } }#include <bits/stdc++.h> using namespace std; #define sz(s) (int)s.size() #define ff first #define ss second int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, t, ans = 0, ind = 0; cin >> n >> t; vector <pair<int,int>> v; vector <int> vis(n+1,0); for(int i = 1; i <= n; i++){ int t1; cin >> t1; if(t1 == 1){ int a, b; cin >> a >> b; ind++; a = (a ^ (t * ans)); b = (b ^ (t * ans)); if(a > b) swap(a,b); v.push_back({a,b}); } if(t1 == 2){ int id, in = 0; cin >> id; vis[--id] = true; } if(t1 == 3){ int a, b, k; cin >> a >> b >> k; a = (a ^ (t * ans)); b = (b ^ (t * ans)); if(a > b) swap(a,b); ans = 0; for(int j = 0; j < sz(v); j++){ if(vis[j]) continue; ans += ((min(b,v[j].ss) - max(a,v[j].ff)) >= k-1); } cout << ans << '\n'; } } }

Compilation message (stderr)

segments.cpp:47:2: error: stray '#' in program
   47 | }#include <bits/stdc++.h>
      |  ^
segments.cpp: In function 'int main()':
segments.cpp:29:12: warning: unused variable 'in' [-Wunused-variable]
   29 |    int id, in = 0;
      |            ^~
segments.cpp: At global scope:
segments.cpp:47:3: error: 'include' does not name a type
   47 | }#include <bits/stdc++.h>
      |   ^~~~~~~
segments.cpp:55:5: error: redefinition of 'int main()'
   55 | int main(){
      |     ^~~~
segments.cpp:9:5: note: 'int main()' previously defined here
    9 | int main(){
      |     ^~~~
segments.cpp: In function 'int main()':
segments.cpp:75:12: warning: unused variable 'in' [-Wunused-variable]
   75 |    int id, in = 0;
      |            ^~