2 条题解

  • -2
    @ 2025-5-5 21:17:47

    #include #include using namespace std;

    int main() { int n; cin >> n; vector<vector> carpets(n, vector(4)); for (int i = 0; i < n; ++i) { cin >> carpets[i][0] >> carpets[i][1] >> carpets[i][2] >> carpets[i][3]; } int x, y; cin >> x >> y; int ans = -1; for (int i = n - 1; i >= 0; --i) { int a = carpets[i][0], b = carpets[i][1], g = carpets[i][2], k = carpets[i][3]; if (x >= a && x <= a + g && y >= b && y <= b + k) { ans = i + 1; break; } } cout << ans << endl; return 0; }

    • -2
      @ 2025-5-5 21:16:59

      #include #include using namespace std; int main() { int n; cin >> n; vector<vector> carpets(n, vector(4)); for (int i = 0; i < n; ++i) { cin >> carpets[i][0] >> carpets[i][1] >> carpets[i][2] >> carpets[i][3]; } int x, y; cin >> x >> y; int ans = -1; for (int i = n - 1; i >= 0; --i) { int a = carpets[i][0], b = carpets[i][1], g = carpets[i][2], k = carpets[i][3]; if (x >= a && x <= a + g && y >= b && y <= b + k) { ans = i + 1; break; } } cout << ans << endl; return 0; }

      • 1

      信息

      ID
      109
      时间
      1000ms
      内存
      128MiB
      难度
      5
      标签
      (无)
      递交数
      48
      已通过
      18
      上传者